Harryxun/stf_run huggingface dataset:
import numpy as np
import collections
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7

if N==K:
  ans0 = 1
  for a in A[0:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
A=sorted(A)  
if (K%2==1 and A[-1]<0):
  ans1 = 1
  for a in A[N-K:N]:
    ans1 *= a
    ans1 %= MOD
  print(ans1)
  exit()

A=sorted(A, key=lambda x:abs(x), reverse=True)
AA=[np.sign(i) for i in A]

ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
ansAA = AA[0:K].count(-1)%2

if ansAA==0:
  print(ansA)
  exit()

B=sorted(A[K-1:N])

if AA[K-1]>0:
  ansB=ansAA//A[K-1]*B[0]
else:ansB=ansAA//A[K-1]*B[-1]

print(ansB)

### FIXED CODE ###

import numpy as np
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7
if N==K:
  ans0 = 1
  for a in A[0:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
A=sorted(A)  
if (K%2==1 and A[-1]<0):
  ans1 = 1
  for a in A[N-K:N]:
    ans1 *= a
    ans1 %= MOD
  print(ans1)
  exit()
 
A=sorted(A, key=lambda x:abs(x), reverse=True)
AA=[np.sign(i) for i in A]
 
ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
ansAA = AA[0:K].count(-1)%2
if ansA==0 or ansAA==0:
  print(ansA)
  exit()

while ansA>0:
  ansA-=MOD

B1=A[0:K]
C1=A[0:K]
B2=sorted(A[K:N])
Bp=[i for i in A[0:K] if i>0]
Bm=[i for i in A[0:K] if i<0]
 
if B2[0]>0:B2.insert(0,0)
if B2[-1]<0:B2.insert(-1,0)
if not Bp:Bp.insert(0,B1[-1])
if not Bm:Bm.insert(0,B1[0])
  
#print(Bp,Bm,B2)
#print(Bp[-1],B2[0])
B1.remove(Bp[-1])
B1.append(min(B2[0],0))
#print(B1)
ansB = 1
for a in B1[0:K]:
  ansB *= a
  ansB %= MOD
#print(Bm[-1],B2[-1])
C1.remove(Bm[-1])
C1.append(max(B2[-1],0))
 
ansC = 1
for a in C1[0:K]:
  ansC *= a
  ansC %= MOD
#print(B1,C1)
#print(ansB,ansC)
BB1=[np.sign(i) for i in B1]
ansBB1 = BB1[0:K].count(-1)%2
BB2=[np.sign(i) for i in C1]
ansBB2 = BB2[0:K].count(-1)%2
#print(ansBB1,ansBB2)
if ansBB1==1:
  print(ansC)
  exit()
if ansBB2==1:
  print(ansB)
  exit()
#print(B2[0]/Bp[-1],B2[-1]/Bm[-1])
#print(Bp[-1]*B2[-1],Bm[0]*B2[0])

#print(abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0]))
#print(ansB,ansC)
if abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0])>=0:
  print(ansC)
else: print(ansB)
L, R = map(int, input().split())
if L <= 2019 <= R:
    print(0)
else:
    lista = []
    int1 = min(L % 2019, 2019 - (L % 2019))
    int2 = min(R % 2019, 2019 - (R % 2019))
    lista.append(int1)
    lista.append(int2)
    lista.append(int1 + 1)
    lista.append(int2 + 1)
    lista.sort()
print(lista[0] * lista[1])

### FIXED CODE ###

L, R = map(int, input().split())
lista = []
for i in range(L, min(R + 1, L + 2019)):
    lista.append(i % 2019)
ans = float('inf')
for i in range(len(lista)):
    for j in range(i + 1, len(lista)):
        ans = min(ans, lista[i] * lista[j] % 2019)
print(ans)
N,M = list(map(int,input().split()))
p = list(map(int,input().split()))
p = [i-1 for i in p]
rem = [True for i in range(N)]
xy = [[] for i in range(N)]
for i in range(M):
    x,y = list(map(int,input().split()))
    x -= 1
    y -= 1
    xy[x].append((y,p.index(y)))
    xy[y].append((x,p.index(x)))
    rem[x] = False
    rem[y] = False
count = 0
for i in range(N):
    if rem[i] and p[i] == i:
        count += 1
alr = rem.copy()
for i in range(N):
    if (not alr[i]) and (xy[i]):
        alr[i] = True
        stack = [*xy[i]]
        indlist = [i[0] for i in xy[i]]
        numlist = [i[1] for i in xy[i]]
        while stack:
            num,ind = stack.pop()
            alr[num] = True
            numlist.append(num)
            indlist.append(ind)
            for j in xy[num]:
                if not alr[j[0]]:
                    alr[j[0]] = True
                    stack.append(j)
        for num in numlist:
            if num in indlist:
                count += 1
print(count)
                
    
        

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
N,M = list(map(int,input().split()))
p = [i-1 for i in map(int,input().split())]
alr = [False for i in range(N)]
xy = [[] for i in range(N)]
for i in range(M):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    xy[x].append(y)
    xy[y].append(x)
count = 0

for i in range(N):
    if (not alr[i]) and (xy[i]):
        alr[i] = True
        stack = [i]
        numlist = set()
        numlist.add(i)
        while stack:
            j = stack.pop()
            for k in xy[j]:
                if not alr[k]:
                    alr[k] = True
                    stack.append(k)
                    numlist.add(k)
        indlist = set([p[i] for i in numlist])
        count += len(numlist & indlist)
    else:
        if (not alr[i]) and p[i] == i:
            count += 1
print(count)
a, b = input().split()
a = int(a)
b = int(b)

tap = 0

if b != 1:
    while ( (tap*(a-1) +1) < b:
        tap += 1

print(tap)


### FIXED CODE ###

a, b = input().split()
a = int(a)
b = int(b)

tap = 0

if b != 1:
    while(tap*(a-1) +1) < b:
        tap += 1

print(tap)
s=input()
k=int(input())
i=0
while s[i]=='1':
  i+=1
if k<=i:
  print(1)
else:
  print(s[i])

### FIXED CODE ###

s=input()
k=int(input())
i=0
while i<len(s) and s[i]=='1':
  i+=1
if k<=i or i==len(s):
  print(1)
else:
  print(s[i])
n=int(input())
a=list(map(int, input().split()))

l=[0]*8

for i in range(n):
  if a[i]<399:
    l[0]="t"
  elif a[i]<799:
    l[1]="t"
  elif a[i]<1199:
    l[2]="t"
  elif a[i]<1599:
    l[3]="t"
  elif a[i]<1999:
    l[4]="t"
  elif a[i]<2399:
    l[5]="t"
  elif a[i]<2799:
    l[6]="t"
  elif a[i]<3199:
    l[7]="t"
  else:
    l[8]+=1
countt=l.count("t")

if countr=0:
  print(countt,countt)
else:
  print(max(0,countt-l[8]),min(countt+1,8))
    

### FIXED CODE ###

n=int(input())
a=list(map(int, input().split()))

l=[0]*9

for i in range(n):
  if a[i]<400:
    l[0]="t"
  elif a[i]<800:
    l[1]="t"
  elif a[i]<1200:
    l[2]="t"
  elif a[i]<1600:
    l[3]="t"
  elif a[i]<2000:
    l[4]="t"
  elif a[i]<2400:
    l[5]="t"
  elif a[i]<2800:
    l[6]="t"
  elif a[i]<3200:
    l[7]="t"
  else:
    l[8]+=1
countt=l.count("t")

if l[8]==0:
  print(countt,countt)
else:
  print(max(countt,1),countt+l[8])
N = int(input())

x_list=[]
y_list=[]
h_list=[]

def all_same(items):
	return all(map(lambda x: x == items[0], items))

for i in range(N):
	x,y,h=map(int, input().split())
	x_list.append(x)
	y_list.append(y)
	h_list.append(h)	
		
for cy in range(101):
	for cx in range(101):
		H_list = []
		for i in range(N):
			if h_list[i] != 0:
				H = abs(cx - x_list[i])+abs(cy - y_list[i])+h_list[i]
				H_list.append(H) 
			if h_list[i] == 0:
				h_mathematical=H_list[0]-abs(cx-x_list[i])-abs(cy-y_list[i])
				if h_mathematical > 0:
					break
		if len(H_list) == N:
			if all_same(H_list):
				print(str(cx)+' '+str(cy)+' '+str(H_list[0]))
				break		
	else:
		continue
	break

### FIXED CODE ###

N = int(input())

x_list=[]
y_list=[]
h_list=[]


def all_same(items):
	return all(map(lambda x: x == items[0], items))

for i in range(N):
	x,y,h=map(int, input().split())
	x_list.append(x)
	y_list.append(y)
	h_list.append(h)
		
for cy in range(101):
	for cx in range(101):
		n = -1	
		for h in h_list:
			n += 1
			if h >= 1:
				H = abs(cx - x_list[n])+abs(cy - y_list[n])+h
				h_now_list=[]
				break
		for i in range(N):
			h_now = max((H-abs(cx - x_list[i])-abs(cy - y_list[i])), 0)
			h_now_list.append(h_now)
			if h_now != h_list[i]:
				break	
			else:
				if len(h_now_list)==N:
					print(str(cx)+' '+str(cy)+' '+str(H))
					break
	else:
		continue
	break
s=list(input())
k=int(input())
count=0
re=""
for i in range(1,len(s)):
    if s[i]==s[i-1]:
        if i==len(s)-1:
            re=s[-1]
        s[i]="A"
        count +=1

if s[0]==s[-1] and s[-1]!="A":
    count +=1
    re=s[-1]
    s[-1]="A"

if s[-1]=="A" and s[-2]!=re:print((count*k)-1)
else:print(count*k)

### FIXED CODE ###

s=list(input())
k=int(input())
A,B,C=0,0,0
test=s*3
for i in range(len(s)*3-1):
    if test[i]==test[i+1]:
        test[i+1]="A"
A=test[:len(s)].count("A")
B=test[len(s):len(s)*2].count("A")
C=test[len(s)*2:len(s)*3].count("A")

if s.count(s[0])==len(s):
    print((len(s)*k)//2)
else:
    if k==1:print(A)
    elif k==2:print(A+B)
    else:print(A+B*(k-2)+C)
print(s[:4],s[4:])

### FIXED CODE ###

s = input()
print(s[:4],s[4:])
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(N, C):
    last = [-1] * N
    pairs = []
    for i, c in enumerate(C):
        prev = last[c - 1]
        if prev >= 0 and prev < i - 1:
            pairs.append((prev, i))
        last[c - 1] = i
    pairs.sort()
    count = [0] * (N + 1)
    count[0] = 1
    idx = 0
    for i in range(N + 1):
        if i > 0:
            count[i] += count[i - 1]
            count[i] %= MOD
        while idx < len(pairs) and pairs[idx][0] == i:
            count[pairs[idx][1]] += count[i]
            count[pairs[idx][1]] %= MOD
            idx += 1
    print(count[N])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, C)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int
MAX_N = 200000

def solve(N, C):
    last = [-1] * MAX_N
    pairs = []
    for i, c in enumerate(C):
        try:
            prev = last[c - 1]
        except:
            if c >= N:
                return
            else:
                raise Exception()
        if prev >= 0 and prev < i - 1:
            pairs.append((prev, i))
        last[c - 1] = i
    pairs.sort()
    count = [0] * N
    count[0] = 1
    idx = 0
    for i in range(N):
        if i > 0:
            count[i] += count[i - 1]
            count[i] %= MOD
        while idx < len(pairs) and pairs[idx][0] == i:
            count[pairs[idx][1]] += count[i]
            count[pairs[idx][1]] %= MOD
            idx += 1
    print(count[N - 1])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, C)

if __name__ == '__main__':
    main()
from math import gcd
n, m, S, T = open(0).read().split()
n, m = int(n), int(m)
l = n*m // gcd(n, m)
A = ['*'] * l
step = l//n
for i in range(n):
    A[i*step] = S[i]
step = l//m
for i in range(m):
    if A[i*step] == T[i] or A[i*step] == '*':
        A[i*step] = T[i]
    else:
        print(-1)
else:
    print(l)

### FIXED CODE ###

from math import gcd
n, m, S, T = open(0).read().split()
n, m = int(n), int(m)
l = n*m // gcd(n, m)

d = {}
t = l//n
for i in range(n):
    d[i*t] = S[i]
t = l//m
for i in range(m):
    if i*t not in d or d[i*t] == T[i]:
        d[i*t] = T[i]
    else:
        print(-1)
        break
else:
    print(l)
import math

a, b, c, d = map(int, input().split())


num_b = b - (b // c) - (b // d) + (b // (c * d / math.gcd(c, d)))
num_a = a - 1 - ((a - 1 ) // c) - ((a - 1) // d) + ((a - 1) // (c * d / math.gcd(c, d)))
num = num_b - num_a

print(int(num))


### FIXED CODE ###

import fractions

a, b, c, d = map(int, input().split())

# 最小公倍数を求める
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def cal(num, a, b):
    x = num // a
    y = num // b
    z = num // (lcm(a, b))
    return num - (x + y - z)

num_a = cal(b, c, d)
num_b = cal(a-1, c, d)

print(num_a - num_b)
n,x,y = map(int,input().split())
k = [0]*(n)

for i in range(1,n):
  for j in range(i+1,n+1):
    ind = abs(x-i) + abs(j-y) + 1
    k[ind] += 1
      
for i in range(1,n):
  print(k[i])

### FIXED CODE ###

n,x,y = map(int,input().split())
k = [0]*(n)

for i in range(1,n):
  for j in range(i+1,n+1):
    if i < x and j <= x:
      k[j-i] += 1
    elif i >= y and j > y:
      k[j-i] += 1
    elif x <= i < y and x<j<=y:
      ind = min(j-i,abs((i-x))+abs((y-j))+1)
      k[ind] += 1
    elif i < x and x<j<=y:
      ind = min(j-i,abs((x-i))+abs((y-j))+1)
      k[ind] += 1
    elif x<=i<y and y<j:
      ind = min(j-i,abs((i-x))+1+abs((j-y)))
      k[ind] += 1
    elif i< x and j > y:
      ind = (x-i) + 1 + (j-y)
      k[ind] += 1
      
for i in range(1,n):
  print(k[i])
for i in range(3):
	L[i] = list(map(int,input().split()))
import numpy as np
L=[]
bingo = np.zeros([3,3])
for i in range(3):
	L.append(input().split())
L = list(np.reshape(L,9))
N = int(input())
for i in range(N):
	l = input()
	if l in L:
		ptr = L.index(l)
		bingo[ptr/3,ptr%3]=1
#print(bingo)
ans = "No"
flg = 0
for i in range(3):
	flg = flg or bingo[i,0] and bingo[i,1] and bingo[i,2]
for i in range(3):
	flg = flg or bingo[0,i] and bingo[1,i] and bingo[2,i]
flg = flg or bingo[0,0] and bingo[1,1] and bingo[2,2]
flg = flg or bingo[2,0] and bingo[1,1] and bingo[0,2]
if flg == 1:
	ans = "Yes"
print(ans)

### FIXED CODE ###

import numpy as np
L=[]
bingo = np.zeros([3,3])
for i in range(3):
	L.append(input().split())
L = list(np.reshape(L,9))
N = int(input())
for i in range(N):
	l = input()
	if l in L:
		ptr = L.index(l)
		bingo[ptr/3,ptr%3]=1
#print(bingo)
ans = "No"
flg = 0
for i in range(3):
	flg = flg or bingo[i,0] and bingo[i,1] and bingo[i,2]
for i in range(3):
	flg = flg or bingo[0,i] and bingo[1,i] and bingo[2,i]
flg = flg or bingo[0,0] and bingo[1,1] and bingo[2,2]
flg = flg or bingo[2,0] and bingo[1,1] and bingo[0,2]
if flg == 1:
	ans = "Yes"
print(ans)
num = input()
 
answer = num + num * num + num * num * num

print(answer)

### FIXED CODE ###

num = int(input())
 
answer = num + num * num + num * num * num
 
print(answer)
a = [[0]*4 for i in range(3)]
b = [0]*4

n, m = map(int,input().split())
for i in range(n):
    a[n] = list(map(int,input().split()))
for j in range(m):
    b[j] = int(input())

c = [0]*3
for i in range(n):
    for j in range(m):
        c[i] += a[i][j] * b[j]

for i in c:
    print(i)


### FIXED CODE ###

n, m = map(int,input().split())
a = [[0]*m for i in range(n)]
b = [0]*m

for i in range(n):
    a[i] = list(map(int,input().split()))
for j in range(m):
    b[j] = int(input())

c = [0]*n
for i in range(n):
    for j in range(m):
        c[i] += a[i][j] * b[j]

for i in c:
    print(i)
N = int(input())
card_num = list(map(int, input().split()) )
card_num.sort(reverse=True)

alice = 0
bob = 0

for i in range(0,N):
  if i %2 == 0:
    alice += card_num[i]
  else:
    bob   += card_num[i+1] 
ans = int(alice - bob)

print(ans)

### FIXED CODE ###

N = int(input())
card_num = list(map(int, input().split()) )
card_num.sort(reverse=True)

alice = 0
bob = 0

for i in range(0,N):
  if i %2 == 0:
    alice += card_num[i]
  else:
    bob   += card_num[i] 
ans = int(alice - bob)

print(ans)
a,b = map(int, input().split())
i=1
sum = a
if sum<=b:
	while sum<=b:
		sum+=a-1
		i+=1
print(i)


### FIXED CODE ###

s = input()
t = input()
ans  =0
for i in range(3):
	if s[i]==t[i]:
		ans += 1
print(ans)
A,B=map(int,input().split())
if A=<5:
  print(0)
elif 6<=A<=12:
  print(B/2)
elif A>=13:
  print(B)

### FIXED CODE ###

A,B=map(int,input().split())
if A<=5:
  print(0)
elif 6<=A<=12:
  print(int(B/2))
elif A>=13:
  print(B)
import sys
ANS = []
N, M = map(int, input().split())
for j in range(N):
  ANS.append(0)
for i in range(M):
  s, c = map(int, input().split())
  ANS[s-1] = c
 
if ANS[0] == 0:
  print(-1)
  sys.exit()
 
NEW = 0
for i in range(N):
  NEW += ANS[-i-1] * (10**(i+1))
 
print(NEW)

### FIXED CODE ###

N = int(input())
print(int((N+1)/2))
r=input()
print(r*r)

### FIXED CODE ###

r=int(input())
r=r*r
print(r)
from math import gcd
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

a,b = map(lambda x : int(x),input().split())
ko = gcd(a,b)
if ko == 1 :
    print(1)
else :
    list = factorize(ko)

    print(len(set(list)) + 1)


### FIXED CODE ###

from fractions import gcd
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

a,b = map(lambda x : int(x),input().split())
ko = gcd(a,b)
if ko == 1 :
    print(1)
else :
    list = factorize(ko)
    print(len(set(list)) + 1)
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B = map(int, input().split())

print(lcm(A,B))


### FIXED CODE ###

import fractions
A, B = map(int, input().split())
tmp = fractions.gcd(A,B)
print((A*B)//tmp)
h,n = map(int,input().split())
moves = list(map(int,input().split()))

s = sum(moves)
if s < h:
    resutl = "No"
else:
    result = "Yes"

print(result)

### FIXED CODE ###

h,n = map(int,input().split())
moves = list(map(int,input().split()))

s = sum(moves)
if s < h:
    resutl = "No"
else:
    resutl = "Yes"

print(resutl)
import sys
import math

a,b,h,m = (float(x) for x in input().split())

zi = 0.5 * 60 * h + 0.5 * m
hun = 6 * h * 60 + 6 * m

if hun >= 360:
    for i in range(11):

        if hun >= 360:
            hun = hun - 360 
        elif hun < 360:
            break

#print(zi)

if hun > zi:
    if hun - zi > 180:
        degree = 360 - hun + zi
    elif hun - zi < 180:
        degree = hun - zi
    elif hun - zi == 180:
        print(a + b)
        sys.exit()

elif zi > hun: 
    if zi - hun > 180:
        degree = 360 - zi + hun
    elif zi - hun < 180:
        degree = zi - hun
    elif hun - zi == 180:
        print(a + b)
        sys.exit()
elif hun == zi:
    if b >= a:
        print(b - a)
        sys.exit()
    else:
        print(a-b)
        sys.exit()

cosain = math.cos(math.radians(degree))

print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * cosain))


    

### FIXED CODE ###

import sys
import math

a,b,h,m = (float(x) for x in input().split())

zi = 0.5 * 60 * h + 0.5 * m
hun = 6 * h * 60 + 6 * m

if hun >= 360:
    for i in range(11):

        if hun >= 360:
            hun = hun - 360 
        elif hun < 360:
            break



if hun > zi:
    if hun - zi > 180:
        degree = 360 - hun + zi
    elif hun - zi < 180:
        degree = hun - zi
    elif hun - zi == 180:
        print(a + b)
        sys.exit(0)

elif zi > hun: 
    if zi - hun > 180:
        degree = 360 - zi + hun
    elif zi - hun < 180:
        degree = zi - hun
    elif zi - hun == 180:
        print(a + b)
        sys.exit(0)
elif hun == zi:
    if b >= a:
        print(b - a)
        sys.exit(0)
    else:
        print(a-b)
        sys.exit(0)

cosain = math.cos(math.radians(degree))

print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * cosain))
import sys

num = 0

while 1:
 x = sys.stdin.readline().strip()
 if x == "0":
  break
 
 num = num + 1
 
 print("case " + str(num) + ": " + x")
 

### FIXED CODE ###

import sys
num = 0
while 1:
    x = sys.stdin.readline().strip()
    if x == "0":
        break
    num = num + 1
    print("Case " + str(num) + ": " + x)
from sys import exit
from math import sqrt
n = int(input())
a = [int(input()) for _ in range(n+1)]
if a[n] == 0:
	x = 1
else:
	x = 0
for i in range(n, -1, -1):
	if a[i] != 0:
		a = a[:i+1]
		n = i
		break
#print(a, n)
#m = abs(sum(a))
while True:
	m = abs(sum([a[i]*pow(x, n-i) for i in range(n+1)]))
	if m != 0:
		break
	x += 1
if x > 0:
	m *= x
#print(m)
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 sum(a)%p == 0:
		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")
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=[]
D[0]=0
for i in range(1,N+2):
  D.append(D[i-1]+L[i-1])
s=0
for j in range(0,N+1):
  if D[j]<=X:
    s+=1
print(s)

### FIXED CODE ###

N,X=map(int,input().split())
L=list(map(int,input().split()))
D=[]
D.append(0)
for i in range(1,N+1):
  D.append(D[i-1]+L[i-1])
s=0
for j in range(0,N+1):
  if D[j]<=X:
    s+=1
print(s)
import sys
sys.setrecursionlimit(2147483647)
input = sys.stdin.readline
N, M, K = map(int, input().split())
graph = [[] for _ in range(N)]
block = [[] for _ in range(N)]
connected_components = []
count = 0
counts = [0 for _ in range(N)]
seen = [False for _ in range(N)]
def dfs(v, c, seen, origin):
    global count
    seen[v] = True
    for node in graph[v]:
        if seen[node] == True:
            continue
        if node not in block[origin]:
            count += 1
        dfs(node, c+1, seen, origin)
def dfs_connected(v, order):
    seen[v] = True
    connected_components[order].append(v)
    for node in graph[v]:
        if seen[node] == True:
            continue
        dfs_connected(node, order)
 
for Mi in range(M):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
 
for Ki in range(K):
    a, b = map(int, input().split())
    block[a-1].append(b-1)
    block[b-1].append(a-1)
 
for v in range(N):
    if seen[v] == True:
        continue
    connected_components.append([])
    dfs_connected(v, v)
 
for components in connected_components:
    for component in components:
        seen = [False for _ in range(N)]
        count = 0
        dfs(component, count, seen, component)
        counts[component] = count-len(graph[component])
 
print(' '.join(map(str, counts)))

### FIXED CODE ###

N = int(input())
x, y = divmod(N, 2)
print(x + y)
nums = input().split()
print(int(num[0]) * int(num[1]))


### FIXED CODE ###

nums = input().split()
print(int(nums[0]) * int(nums[1]))
import sys
input = sys.stdin.radline
n = int(input())
l = list(map(int,input().split()))
import bisect
l.sort()
count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        s = bisect.bisect_left(l[j+1:],l[a]+l[b])
        count += s
        # print(l,a,b,s)
print(count)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int,input().split()))
import bisect
l.sort()
count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        count += bisect.bisect_left(l,l[i]+l[j]) - j - 1
print(count)
n = int(input())
ans = 0
for i in range(i,n+1):
  if len(str(i))%2 != 0:
    ans += 1
print(ans)
 

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1,n+1):
  if len(str(i))%2 != 0:
    ans += 1
print(ans)