import time
from random import randint
arr = [5, 3, 1, 3, 5, 2, 5, 3, 1, 3, 5, 2, 5]
arr1 = [1, 1, 1, 1]
arr2 = [3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3]
arr3 = [5, 4, 2, 1, 5]
arr4 = [4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 2, 4]
arr5 = [4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4]
arr_time = [randint(0, 10) for _ in range(29999)]
arr_time.append(arr_time[0])
def sectors(arr):
l, last = 0, len(arr) - 1
while l < last:
l = arr[l+1:].index(arr[0]) + l + 1
if last % l != 0:
continue
for i in range(last // l):
if arr[0:l] != arr[l * i: l * (i + 1)]:
break
else:
break
return l
a = sectors(arr)
b = sectors(arr1)
c = sectors(arr2)
d = sectors(arr3)
e = sectors(arr4)
f = sectors(arr5)
print(a,b,c,d,e,f)
t = time.time()
print(sectors(arr_time))
print("Array of %d elements took %.3f seconds to process" % (len(arr_time), time.time() - t))
aW1wb3J0IHRpbWUKZnJvbSByYW5kb20gaW1wb3J0IHJhbmRpbnQKCmFyciA9IFs1LCAzLCAxLCAzLCA1LCAyLCA1LCAzLCAxLCAzLCA1LCAyLCA1XQphcnIxID0gWzEsIDEsIDEsIDFdCmFycjIgPSBbMywgMiwgMSwgMywgMiwgMSwgMywgMiwgMSwgMywgMiwgMSwgMywgMiwgMSwgM10KYXJyMyA9IFs1LCA0LCAyLCAxLCA1XQphcnI0ID0gWzQsIDMsIDQsIDMsIDQsIDIsIDQsIDMsIDQsIDMsIDQsIDIsIDRdCmFycjUgPSBbNCwgMywgNCwgMywgNCwgMywgNCwgMywgNCwgMywgNCwgMywgNF0KYXJyX3RpbWUgPSBbcmFuZGludCgwLCAxMCkgZm9yIF8gaW4gcmFuZ2UoMjk5OTkpXQphcnJfdGltZS5hcHBlbmQoYXJyX3RpbWVbMF0pCgpkZWYgc2VjdG9ycyhhcnIpOgoJbCwgbGFzdCA9IDAsIG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