Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
S = str(input())
S_list = []
cum_list = [0]
tmp = 1
count = 0
if S == "1":
    print(1)
else:
    for i in range(N):
        if i == 0:
            if int(S[i]) == tmp:
                count += 1
            else:
                S_list.append(count)
                count = 1
        else:
            if S[i] == S[i - 1]:
                count += 1
                if i == N - 1:
                    S_list.append(count)
            else:
                S_list.append(count)
                count = 1


    if S[-1] == "0":
        S_list.append(0)




    now = 0
    for i in range(len(S_list)):
        now += S_list[i]
        cum_list.append(now)
    def check(x,K):
        answer_list = []
        i = 0
        if i + 2 * K + 1 < len(x):
            while i + 2 * K + 1 < len(x):
                answer_list.append(x[i + 2 * K + 1] - x[i])
                i += 2
            return answer_list
        elif K > 0:
            check(x,K-1)
    answer_list = check(cum_list,K)

    answer = max(answer_list)
    print(answer)

### FIXED CODE ###

N, K = map(int, input().split())
S = str(input())
S_list = []
cum_list = [0]
tmp = 1
count = 0

for i in range(N):
    if i == 0:
        if int(S[i]) == tmp:
             count += 1
        else:
            S_list.append(count)
            count = 1
    else:
        if S[i] == S[i - 1]:
            count += 1
            
        else:
            S_list.append(count)
            count = 1

S_list.append(count)
if S[-1] == "0":
    S_list.append(0)


now = 0
for i in range(len(S_list)):
    now += S_list[i]
    cum_list.append(now)


answer_list = []
i = 0
if 2 * K + 1 < len(cum_list):
    while i + 2 * K + 1 < len(cum_list):
        answer_list.append(cum_list[i + 2 * K + 1] - cum_list[i])
        i += 2
else:
    answer_list.append(len(S))
answer = max(answer_list)
print(answer)
print([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][int(input())])

### FIXED CODE ###

print([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][int(input())-1])
def main():
  points = [[False for i in range(5001)] for j in range(5001)]
  while True:
    n = int(input())
    if not n:
      break
    ps = []

    for i in range(n):
      x, y = map(int,input().split())
      points[x][y] = True
      ps.append((x,y))
  
    ans = 0
  
    for i in range(n):
      for j in range(n):
        p1 = ps[i]
        p2 = ps[j]
        vx = p2[0] - p1[0]
        vy = p2[1] - p1[1]
        if  0 <= p1[0] + vy <= 5000 and 0 <= p1[1] - vx <= 5000 and 0 <= p2[0] + vy <= 5000 and 0 <= p2[1] - vx <= 5000:
          if  points[p1[0] + vy][p1[1] - vx] and points[p2[0] + vy][p2[1] - vx]:
            ans = max(ans, vx ** 2 + vy ** 2)
    
    for p in ps:
      points[p[0]][p[1]] = False

    print(ans)
main()  





### FIXED CODE ###

def main():
  while True:
    n = int(input())
    if not n:
      break
    ps = [tuple(map(int,input().split())) for i in range(n)]
    dic = set()
    for t in ps:
      dic.add(t)
    ans = 0
  
    for i in range(n):
      p1 = ps[i]
      p1x = p1[0]
      p1y = p1[1]
      for j in range(n):
        p2 = ps[j]
        p2x = p2[0]
        p2y = p2[1]
        vx = p2x - p1x
        vy = p2y - p1y
        if (p1x + vy , p1y - vx) in dic and (p2x + vy , p2y - vx) in dic:
          ans = max(ans, vx ** 2 + vy ** 2)
    

    print(ans)
main()
r = input()
r = int(a)
print(3*r*r)

### FIXED CODE ###

r = input()
a = int(r)
print(3*a*a)
N, K = map(int, input().split())
import math
def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
for j in range(K):
  if (2*j+1)>N:
    print(0)
  else:
    x = (nCr((K-1), j) * nCr(N-K+1, j+1))
    if (x > (10**9+7)):
         print(x%(10**9+7))
    else:
         print(x)

### FIXED CODE ###

N, K = map(int, input().split())
from operator import mul
from functools import reduce
 
def nCr(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
 
for j in range(K):
  if (K+j)>N:
    print(0)
  else:
    x = (nCr((K-1), j) * nCr(N-K+1, j+1))
    if (x > (10**9+7)):
         print(x%(10**9+7))
    else:
         print(x)
while True:
    n = int(input())
    if n == 0:
        break
    
    sum_a = 0
    sum_b = 0
    
    for i in range(n):
        a,b = map(int, raw_input().split())
        
        if a > b:
            sum_a = sum_a + a + b
        elif a < b:
            sum_b = sum_b + a + b
        elif a == b:
            sum_a = sum_a + a
            sum_b = sum_b + b

    print(sum_a,sum_b)

        



### FIXED CODE ###

while 1:
    n = int(input())
    if n == 0:
        break
    
    sum_a = 0
    sum_b = 0
    
    for i in range(n):
        a,b = map(int, input().split())
        
        if a > b:
            sum_a = sum_a + a + b
        elif a < b:
            sum_b = sum_b + a + b
        elif a == b:
            sum_a = sum_a + a
            sum_b = sum_b + b

    print(sum_a,sum_b)
if __name__ == "__main__":
    """
    N
    h1 h2 h3 .. hn
    """

    N = int(input())

    if N < 2:
        print(0)

    heights = [int(x) for x in input().split()]

    dp = [0] * N
    dp[0] = 0
    dp[1] = abs(heights[1] - heights[0])

    for i in range(2, N):
        dp[i] = min(dp[i-1] + abs(heights[i] - heights[i-1]),
                    dp[i - 2] + abs(heights[i] - heights[i - 2]))

    print(dp[-1])

### FIXED CODE ###

N = int(input())

if N < 2:
    print(0)

heights = [int(x) for x in input().split()]

dp = [0] * N
dp[0] = 0
dp[1] = abs(heights[1] - heights[0])

for i in range(2, N):
    dp[i] = min(dp[i-1] + abs(heights[i] - heights[i-1]),
                dp[i - 2] + abs(heights[i] - heights[i - 2]))

print(dp[-1])
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

readline = sys.stdin.buffer.readline
iimr = lambda: map(int, sys.stdin.buffer.readline().rstrip().split())
#sys.setrecursionlimit(10 ** 8)

def debug(*x):
    print(*x, file=sys.stderr)


class atcoder():
    def __init__(self):
        pass

    def çözmek(self):
        N = int(input())
        A = list(map(int, sys.stdin.buffer.readline().split()))
        res = []
        res.append(self.関数(N, A))
        print(*res, "")	
    
    def 関数(self, n, Aliste):
        res = 0
        for i in range(1, n):
            if Aliste[i - 1] > Aliste[i]:
                res += Aliste[i - 1] - Aliste[i]
                Aliste[i] = Aliste[i - 1]

        return res

if __name__ == "__main__":
    ima = atcoder()
    ima.çözmek()



### FIXED CODE ###

#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

readline = sys.stdin.buffer.readline

#iimr = lambda: map(int, sys.stdin.buffer.readline().rstrip().split())
# il ne y a pas plus le buffer sur atcoder
iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
#sys.setrecursionlimit(10 ** 8)

def debug(*x):
    print(*x, file=sys.stderr)


class atcoder():
    def __init__(self):
        pass

    def çözmek(self):
        N = int(input())
        A = list(map(int, sys.stdin.readline().split()))
        res = []
        res.append(self.関数(N, A))
        print(*res, "")	
    
    def 関数(self, n, Aliste):
        res = 0
        for i in range(1, n):
            if Aliste[i - 1] > Aliste[i]:
                res += Aliste[i - 1] - Aliste[i]
                Aliste[i] = Aliste[i - 1]

        return res

if __name__ == "__main__":
    ima = atcoder()
    ima.çözmek()
from collections import deque
N, M = map(int, input().split())
G = [[] for _ in range(N+1)]
for _ in range(M):
    tmpl, tmpr, tmpd = map(int, input().split())
    G[tmpl].append((tmpr, tmpd))
    G[tmpr].append((tmpl, -tmpd))

field = [None] * (N+1)


def dfs(i):
    for elem in G[i]:
        if field[elem[0]] is not None:
            if field[elem[0]] != field[i]+elem[1]:
                return False
            continue
        else:
            field[elem[0]] = field[i]+elem[1]
            dfs(elem[0])
    return True


for i in range(1, N+1):
    if field[i] is None:
        field[i] = 0
        if not dfs(i):
            print('No')
            exit()
print('Yes')


### FIXED CODE ###

from collections import deque
N, M = map(int, input().split())
#L = []
#R = []
#D = []
G = [[] for _ in range(N+1)]
for _ in range(M):
    tmpl, tmpr, tmpd = map(int, input().split())
    # L.append(tmpl)
    # R.append(tmpr)
    # D.append(tmpd)
    G[tmpl].append((tmpr, tmpd))
    G[tmpr].append((tmpl, -tmpd))

field = [None] * (N+1)


def dfs(i):
    q = deque()
    q.append(i)
    field[i] = 0
    #used = [False]*(N+1)
    #used[i] = True
    while q:
        tmp = q.pop()
        for elem in G[tmp]:
            if field[elem[0]] is not None:
                if field[elem[0]] != field[tmp]+elem[1]:
                    return False
                continue
            else:
                q.append(elem[0])
                field[elem[0]] = field[tmp]+elem[1]

            # if used[elem[0]]:
            #    if field[elem[0]] is not None:
            #        if field[elem[0]] != field[tmp]+elem[1]:
            #            return False
            #    continue
            # q.append(elem[0])
            # if field[elem[0]] == None:
            #    field[elem[0]] = field[tmp]+elem[1]
            #    used[elem[0]] = True
            # else:
            #    if field[elem[0]] != field[tmp]+elem[1]:
            #        return False

    return True


for i in range(1, N+1):
    if field[i] == None:
        if not dfs(i):
            print('No')
            exit()
print('Yes')
import numpy as np;
from numba import jit
import warnings
from operator import mul
from functools import reduce
warnings.simplefilter('ignore')
    

if __name__ == '__main__':
    try:

        N = int(input())
        A = list(map(int, input().split()))
        ans = reduce(mul, A)
        if ans > 10 ** 18:
        print(-1)
        else:
            print(ans)
    except:
        print(-1)

### FIXED CODE ###

import numpy as np;




if __name__ == '__main__':
    a, b = map(int, input().split())
    print(a*b)
import sys

N, K= map(int, input().split())
S = input()

ones_list = S.split('0')
zeros_list = S.split('1')

ones = []
if S[0] == '0':
    ones.append(0)
for k in range(len(ones_list)):
    if ones_list[k] != '':
        ones.append(len(ones_list[k]))
if S[-1] == '0':
    ones.append(0)

zeros = []
for k in range(len(zeros_list)):
    if zeros_list[k] != '':
        zeros.append(len(zeros_list[k]))

if K >= len(zeros):
    print(len(S))
    sys.exit

if len(zeros) == 0:
    print(len(S))
    sys.exit

if len(ones) == 0:
  	print(len(S))
    sys.exit

result = []
maximum = 0
for k in range(K):
    maximum += ones[k]
    maximum += zeros[k]
maximum += ones[K]
result.append(maximum)


for j in range(len(ones) - K - 1):
    maximum += zeros[K+j] + ones[K+1+j] - ones[j] - zeros[j]
    result.append(maximum)
print(max(result))

### FIXED CODE ###

import sys

N, K= map(int, input().split())
S = input()

ones_list = S.split('0')
zeros_list = S.split('1')

ones = []
if S[0] == '0':
    ones.append(0)
for k in range(len(ones_list)):
    if ones_list[k] != '':
        ones.append(len(ones_list[k]))
if S[-1] == '0':
    ones.append(0)

zeros = []
for k in range(len(zeros_list)):
    if zeros_list[k] != '':
        zeros.append(len(zeros_list[k]))

if K >= len(zeros):
    print(len(S))
    sys.exit()

result = []
maximum = 0
for k in range(K):
    maximum += ones[k]
    maximum += zeros[k]
maximum += ones[K]
result.append(maximum)


for j in range(len(ones) - K - 1):
    maximum += zeros[K+j] + ones[K+1+j] - ones[j] - zeros[j]
    result.append(maximum)
print(max(result))
a,b = str(input().split())
x,y = int(input().split())
k = str(input())

if a == k :
  print(x-1,y)
elif b == k :
  print(x,y-1)
else:
  print(x,y)

### FIXED CODE ###

S,T = input().split()
A,B = map(int, input().split())
U = input()

if S==U:
    A -= 1
else:
    B -= 1
print(A,B)
a,b=map(int,input().split())
print([a,a-1][a>b])

### FIXED CODE ###

print(700+100*input().count('o'))
A1,A2,A3=map(int, input().split())
print(f'{"bust" if A1+A2+A3>=22 else "win"}' )

### FIXED CODE ###

A1,A2,A3=map(int, input().split())
if A1+A2+A3>=22:
  print("bust")
else:
  print("win")
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = sorted(A)
BC = [list(map(int,input().split())) for i in range(M)]
BC.sort(key = lambda x:-x[1])

index = 0
for i in range(len(BC)):
    for j in range(BC[i][0]):
        if A[index] >= BC[i][1]:
            break
        else:
            A[index] = BC[i][1]
            index += 1
            if index == len(A):
                break

print(sum(A))

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
A = sorted(A)
BC = [list(map(int,input().split())) for i in range(M)]
BC.sort(key = lambda x:-x[1])

index = 0
for i in range(len(BC)):
    for j in range(BC[i][0]):
        if index == len(A) or A[index] >= BC[i][1]:
            break

        else:
            A[index] = BC[i][1]
            index += 1

print(sum(A))
A, B = map(int, input().split())
print(max([A+B, A-B, A*B])

### FIXED CODE ###

A, B = map(int, input().split())
print(max([A+B, A-B, A*B]))
[S, W] = list(map(int, input().split()))
if W >= S:
    print('unsafe')
else:
    print('safe')

### FIXED CODE ###

[A, B, C, D] = list(map(int, input().split()))
while A > 0:
    C -= B
    if C <= 0:
        print('Yes')
        break
    A -= D
    if A <= 0:
        print('No')
        break
n = input()
a = map(int raw_input().split())
print ("%d %d %d") % (min(a), max(a), sum(a))

### FIXED CODE ###

n = raw_input()
a = map(int, raw_input().split())
print ("%d %d %d") % (min(a), max(a), sum(a))
import math
n=int(input())
miti=list(map(int,input().split()))
mini=min(miti)
retu=n//miti
if n<=mini:
  print(5)
else:
  print(4+retu)

### FIXED CODE ###

import math
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
miti=[a,b,c,d,e]
mini=min(miti)
retu=math.ceil(n/mini)
print(4+retu)
N, M = [int(a) for a in input().split()]
S = [[int(i) for i in input().split()] for _ in range(M)]
if([1,0] in S):
  print(-1)
else:
  NUM = 0
  LIST = [-1 for _ in range(M)]
  for s,c in S:
    s -= 1
    if(LIST[s]==-1):
      NUM += c*(10**(N-s-1))
      LIST[s] = c
    else:
      if(LIST[s]!=c):
        print(-1)
        break
      else:
        continue
  if(LIST[0] == -1):
    NUM += 10**(N-1)
  print(NUM)

### FIXED CODE ###

N, M = [int(a) for a in input().split()]
S = [[int(i) for i in input().split()] for _ in range(M)]
flag = 0
NUM = 0
LIST = [-1 for _ in range(N)]
for s,c in S:
    s -= 1
    if(LIST[s]==-1):
        NUM += c*(10**(N-s-1))
        LIST[s] = c
    else:
        if(LIST[s]!=c):
            flag = 1
            print(-1)
            break
        else:
            continue
if(LIST[0] == -1):
    if(N>1):
        NUM += 10**(N-1)
    else:
        NUM = 0
elif(LIST[0] == 0):
    if(N>1):
        print(-1)
        flag = 1
    else:
        NUM = 0
if(flag==0):
    print(NUM)
input()
l = list(map(int, input().split())).sort(reverse = True)
print('Yes' if l[0] < sum(l[1:]) else 'No')

### FIXED CODE ###

input()
l = list(map(int, input().split()))
l.sort(reverse = True)
print('Yes' if l[0] < sum(l[1:]) else 'No')
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
from queue import PriorityQueue
from fractions import gcd
inf, eps, mod = 10 ** 20, 1.0 / 10**10, 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def _cumsum(l): return list(itertools.accumulate(l))

"""
なかのものと端のもの
両端が一緒かどうか
一緒なら、K-1個変える
中を変える/2切り下げ
まず、端が一緒か
"""
S = input()
K = _I()

ans = 0
if S[0] == S[-1]:
    if S[-1] == S[-2]:
        ans += 1
    S = S[:-1] + '?'
    ans += K - 1
    # 端は上で変えられた
else:
    pass

# 端変えないので、中だけ
previous = 'HOGE'
for s in S:
    if s == previous:
        ans += K
        previous = 'HOGE'
    else:
        previous = s
print(ans)


### FIXED CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, pdb
sys.setrecursionlimit(10**7)
from queue import PriorityQueue
from fractions import gcd
inf, eps, mod = 10 ** 20, 1.0 / 10**10, 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def _cumsum(l): return list(itertools.accumulate(l)) 
"""
なかのものと端のもの
両端が一緒かどうか
一緒なら、K-1個変える
中を変える/2切り下げ
まず、端が一緒か
"""
S = input()
K = _I()
ans = 0

if len(set(S)) == 1:
    print(int(math.floor(len(S)*K/2)))
    exit()

S2 = S*2
S3 = S*3

torn_list_1 = []
previous = 'hoge'
for s in S2:
    if s == previous:
        torn_list_1[-1] += 1
    else:
        torn_list_1.append(1)
        previous = s
torn_list_2 = []
previous = 'hoge'
for s in S3:
    if s == previous:
        torn_list_2[-1] += 1
    else:
        torn_list_2.append(1)
        previous = s

ans2 = 0
ans3 = 0
for t in torn_list_1:
    if t>=2:
        ans2+=int(math.floor(t/2))

for t in torn_list_2:
    if t>=2:
        ans3+=int(math.floor(t/2))

diff = ans3-ans2

ans = ans2 + (K-2)*diff
print(ans)
num = int(input())
num_min = 100001
num_max = -100001
num_sum = 0

a = []
a = [ *map(int,input().split() ) ]


for i in range(num):
	if a[i]<num_min:
		num_min = a[i]

	if a[i]>num_max:
		num_max = a[i]

	num_sum+=a[i]

# print("{0} {1} {2}".format(num_min,num_max,num_sum) );

### FIXED CODE ###

# 09-Computation-Min_Max_and_Sum.py

# ????°????????????§??????????¨????
# n ????????´??° ai(i=1,2,...n)?????\?????????????????????????°????????????§??????????¨????????±???????????????°????????????????????????????????????

# Input
# ??????????????´??°?????° n ???????????????????????????????????? n ????????´??° ai ????????????????????§?????????????????????
# Output
# ????°????????????§??????????¨????????????????????????§????????????????????????????????????

# Constraints
# 0<n???10000
# ???1000000???ai???1000000
# Sample Input
# 5
# 10 1 5 4 17
# Sample Output
# 1 17 37

num_min = 1000001
num_max = -1000001
num_sum = 0
num = int(input())

# a = []
# a = [ *map(int,input().split() ) ]
a = input().split()

for i in range(num):
	a[i]=int(a[i])
	if a[i]<num_min:
		num_min = a[i]

	if a[i]>num_max:
		num_max = a[i]

	num_sum+=a[i]

print("{0} {1} {2}".format(num_min,num_max,num_sum) );
import sys
input = sys.stdin.readline
from math import factorial

def main():
	n, k = map(int, input().strip().split())
	for i in range(1, k+1):
		c = factorial(k-1)//(factorial(k-i)*factorial(i-1))
		noko = factorial(n-k+1)//(factorial(i) * factorial(n-k-i+1))
		# print(c, noko)
		ans = c * noko
		# print(ans)
		ans %= 10**9+7
		print(ans)


if __name__ == '__main__':
	main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
from math import factorial

def main():
	n, k = map(int, input().strip().split())
	for i in range(1, k+1):
		if i-1 > n - k:
			print(0)
			continue
		c = factorial(k-1)//(factorial(k-i)*factorial(i-1))
		noko = factorial(n-k+1)//(factorial(i) * factorial(n-k-i+1))
		# print(c, noko)
		ans = c * noko
		# print(ans)
		ans %= 10**9+7
		print(ans)


if __name__ == '__main__':
	main()
import math

a,b,h,m=map(int,input().split())

hour_angle=0.5*(60*h+m)
minute_angle=6*m

diff_angle=abs(hour_angle-minute_angle)

angle=min(360-diff_angle,diff_angle)
cos_angle=math.cos(angle*(math.pi/180))

lenth=math.sqrt(a**2+b**2-(2*a*b*cos_angle))
print(lenth)



### FIXED CODE ###

n=int(input())
n=n%10

if n==3:
  print("bon")
elif n==0 or n==1 or n==6 or n==8:
  print("pon")
else:
  print("hon")
from sys import exit
from math import sqrt
n = int(input())
a = [int(input()) for _ in range(n+1)]
xx = [0, 1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6]
for x in xx:
	m = abs(sum([a[i]*pow(x, n-i) for i in range(n+1)]))
	if m != 0:
		break
	x += 1
ans, ps = [], []
for i in range(2, int(sqrt(m))+1):
	if m%i == 0:
		ps.append(i)
		while m%i == 0:
			m //= i
if m != 1:
	ps.append(m)
if n == 0:
	if ps:
		print(*ps, sep="\n")
	exit()
a = a[::-1]
for p in ps:
	if p-1 > n:
		ng = False
		for i in range(1, n+1):
			if a[i]%p != 0:
				ng = True
				break
		if not ng:
			print(p)
	else:
		mods = [0 for _ in range(p-1)]
		for i in range(1, n+1):
			mods[i%(p-1)] += a[i]
			mods[i%(p-1)] %= p
		if mods[0] == 0:
			ng = False
			for i in range(1, p-1):
				if mods[i] != 0:
					ng = True
					break
			if not ng:
				print(p)

### FIXED CODE ###

import sys
from fractions import gcd
n = int(input())
a = [int(input()) for _ in range(n+1)]
x = 0
while True:
	m = abs(sum([a[i]*pow(x, n-i) for i in range(n+1)]))
	if m != 0:
		break
	x += 1
ps = []

i = 2
while i**2 <= m and i <= n+1:
#for i in range(2, int(sqrt(m))+1):
	if m%i == 0:
		ps.append(i)
		while m%i == 0:
			m //= i
	i += 1
if m != 1 and n != 0:
	ps.append(m)
#print(ps)
g = a[0]
for i in range(1, n+1):
	g = gcd(g, abs(a[i]))

#print(g)
ans = []

i = 2
while i**2 <= g:
#for i in range(2, int(sqrt(m))+1):
	if g%i == 0:
		if i >= n+1:
			ans.append(i)
		while g%i == 0:
			g //= i
	i += 1
if g != 1 and g >= n+1:
	ans.append(g)

a = a[::-1]
for p in ps:
	if p-1 > n:
		ng = False
		for i in range(1, n+1):
			if a[i]%p != 0:
				ng = True
				break
		if not ng:
			ans.append(p)
	else:
		mods = [0 for _ in range(p-1)]
		for i in range(1, n+1):
			mods[i%(p-1)] += a[i]
			mods[i%(p-1)] %= p
		if mods[0] == 0:
			ng = False
			for i in range(1, p-1):
				if mods[i] != 0:
					ng = True
					break
			if not ng:
				ans.append(p)
ans = sorted(list(set(ans)))
if ans:
	print(*ans, sep="\n")
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10*6)

n, q = map(int, input().split())
graph = [[] for _ in range(n)]

for i in range(n - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    graph[u].append(v)
    graph[v].append(u)

ans = [0] * n

for i in range(q):
    p, x = map(int, input().split())
    ans[p-1] += x


def dfs(cur, par):
    for chl in graph[cur]:
        if chl == par:
            continue
        ans[chl] += ans[cur]
        dfs(chl, cur)


dfs(0, -1)
print(*ans)


### FIXED CODE ###

from collections import deque

n, q = map(int, input().split())
cnt = [0] * (n + 1)
g = [[] for _ in range(n + 1)]

for _ in range(n - 1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)

for _ in range(q):
    u, v = map(int, input().split())
    cnt[u] += v

q = deque()
q.append(1)
checked = [0] * (n + 1)

while q:
    v = q.pop()
    checked[v] = 1
    for u in g[v]:
        if checked[u] == 1:
            continue
        cnt[u] += cnt[v]
        q.append(u)
print(*cnt[1:])
n, m = map(int, input().split())

if n % 2 == 0:
    i = 1
    while i <= m:
        if i < (n - 2) // 2
            a_i = str(i)
        else:
            a_i = str(i + 1)
        b_i = str(n - i)
        
        print(a_i + " " + b_i)
        i += 1
        
elif n % 2 == 1:
    for i in range(1, m + 1):
        a_i = str(i)
        b_i = str(n - i)
        
        print(a_i + " " + b_i)


### FIXED CODE ###

n, m = map(int, input().split())

if n % 2 == 0:
    i = 1
    while i <= m:
        a_i = str(i)
        
        if i <= (n - 2) // 4:
            b_i = str(n - i)
        else:
            b_i = str(n - i - 1)
        
        print(a_i + " " + b_i)
        i += 1
        
elif n % 2 == 1:
    for i in range(1, m + 1):
        a_i = str(i)
        b_i = str(n - i)
        
        print(a_i + " " + b_i)