Harryxun/stf_run huggingface dataset:
N = int(input())
arr = list(map(int, input().split()))
for i in range(min(N,25)):
    if arr[i] > 2**i:
        print(-1)
        exit()
sum_arr = [0]*N
sum_arr[0] = arr[-1]
for i in range(1,N):
    sum_arr[i] = sum_arr[i-1]+arr[N-i]
sum_arr = sum_arr[::-1]
ans = [0]*(N+1)
ans[0] = 1
for i in range(1,N+1):
    if ans[i-1]-arr[i-1] < 0:
        print(-1)
        exit()
    if (ans[i-1]-arr[i-1])*2 <= sum_arr[i-1]:
        tmp = (ans[i-1]-arr[i-1])*2
    else:
        tmp = sum_arr[i-1]
    ans[i] = tmp
print(sum(ans))

### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))
if N == 0:
    if arr[0] == 1:
        print(1)
    else:
        print(-1)
    exit()
else:
    if arr[0] != 0:
        print(-1)
        exit()
sum_arr = [0]*N
sum_arr[0] = arr[-1]
for i in range(1,N):
    sum_arr[i] = sum_arr[i-1]+arr[N-i]
sum_arr = sum_arr[::-1]
ans = [0]*(N+1)
ans[0] = 1
for i in range(1,N+1):
    if ans[i-1]-arr[i-1] < 0:
        print(-1)
        exit()
    tmp = min((ans[i-1]-arr[i-1])*2,sum_arr[i-1])
    ans[i] = tmp
for i in range(min(25,N+1)):
    if ans[i] > 2**i:
        print(-1)
        exit()
if ans[N] != arr[-1]:
    print(-1)
    exit()
print(sum(ans))
n = int(input())
a = list(map(int,input().split()))
 
ans = 0
while True:
  e = [i for i in a if i % 2 == 0]
  #print(e)
  if len(e) != 0:
    e_max = max(e)
    a = [i / 2 if i == e_max else i * 3 for i in e]
    ans += 1
  else:
    break
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
 
ans = 0
e = [i for i in a if i % 2 == 0]
for i in e:
  sum = 0
  while True:
    i = i / 2
    sum += 1
    if i % 2 != 0:
      break
  ans += sum
print(ans)
n,m=map(int, input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
ans = 1
for i in make_divisors:
    if i>=n:
        ans=max(ans,m//i)
print(ans)

### FIXED CODE ###

n,m=map(int, input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
ans = 1
for i in make_divisors(m):
    if i>=n:
        ans=max(ans,m//i)
print(ans)
a=input()
b=input()

print(ab,2(a+b))

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b,2*(a+b))
k, x = map(int,input().split())

if k*500 < X:
    print("No")
else:
    print("Yes")


### FIXED CODE ###

k, x = map(int,input().split())

if k*500 < x:
    print("No")
else:
    print("Yes")
n = int(input())
s = 0

if int(n/100) == 1:
    s ++
if n%100 => 10:
    s ++
if n%10 == 1:
    s ++

print(s)

### FIXED CODE ###

n = int(input())
s = 0

if int(n/100) == 1:
    s += 1
if n%100 >= 10:
    s += 1
if n%10 == 1:
    s += 1

print(s)
def dfs(i, z):
    print "." * z + name[i]
    for j in child[i]:
        dfs(j, z + 1)

n = int(raw_input())
name = []
child = [[] for i in xrange(n)]
for i in xrange(n):
    k = int(raw_input())
    m = raw_input()
    name.append(m)
    if k == 0: continue
    child[k - 1].append(i)

dfs(0, 0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(9999)
def dfs(i, z):
    print "." * z + name[i]
    for j in child[i]:
        dfs(j, z + 1)

n = int(raw_input())
name = []
child = [[] for i in xrange(n)]
for i in xrange(n):
    k = int(raw_input())
    m = raw_input()
    name.append(m)
    if k == 0: continue
    child[k - 1].append(i)

dfs(0, 0)
import re

s = input()
ans = []
while len(s) > 0:
    ans.append(len(re.match("[ATCG]*", s)[0]))
    s = s[1:-1]
print(max(ans))


### FIXED CODE ###

s = input()+"E"
ans = []
c=0
for st in s:
    if st in ["A","T","C","G"]:
        c+=1
    else:
        ans.append(c)
        c=0
print(max(ans))
import sys
from collections import deque
def input(): return sys.stdin.readline().rstrip()


def main():
    h, w = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    Ch -= 1
    Cw -= 1
    Dh -= 1
    Dw -= 1
    s2 = [list(input()) for i in range(h)]
    s2[Ch][Cw] = 0
    d = deque()
    d.append([Ch, Cw])
    while d:
        nowh, noww = d.popleft()
        for i, j in [[0, 1], [1, 0], [0, -1], [-1, 0]]:
            if ((0 <= nowh+i < h) and (0 <= noww+j < w)):
                if s2[nowh+i][noww+j] == '.':
                    s2[nowh+i][noww+j] = s2[nowh][noww]
                    d.appendleft([nowh+i, nowh+j])
                elif s2[nowh+i][noww+j] != '#':
                    if s2[nowh+i][noww+j] > s2[nowh][noww]:
                        s2[nowh+i][noww+j] = s2[nowh][noww]
                        d.append([nowh+i, noww+j])
        for i in [-2,-1,0,1,2]:
            for j in [-2,-1,0,1,2]:
                if ((0 <= nowh+i < h) and (0 <= noww+j < w)):
                    if s2[nowh+i][noww+j] == '.':
                        s2[nowh+i][noww+j] = s2[nowh][noww]+1
                        d.append([nowh+i, noww+j])
                    elif s2[nowh+i][noww+j] != '#':
                        if s2[nowh+i][noww+j] > s2[nowh][noww]+1:
                            s2[nowh+i][noww+j] = s2[nowh][noww]+1
                            d.append([nowh+i, noww+j])
    if s2[Dh][Dw] == '.':
        print(-1)
    else:
        print(s2[Dh][Dw])


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
from collections import deque
def input(): return sys.stdin.readline().rstrip()
 
 
def main():
    h, w = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    Ch -= 1
    Cw -= 1
    Dh -= 1
    Dw -= 1
    s2 = [list(input()) for i in range(h)]
    s2[Ch][Cw] = 0
    d = deque()
    d.append([Ch, Cw])
    while d:
        nowh, noww = d.popleft()
        if [nowh,noww]==[Dh,Dw]:
            print(s2[nowh][noww])
            exit()
        for i, j in [[0, 1], [1, 0], [0, -1], [-1, 0]]:
            if ((0 <= nowh+i < h) and (0 <= noww+j < w)):
                if s2[nowh+i][noww+j] == '.':
                    s2[nowh+i][noww+j] = s2[nowh][noww]
                    d.appendleft([nowh+i, noww+j])
                elif s2[nowh+i][noww+j] != '#':
                    if s2[nowh+i][noww+j] > s2[nowh][noww]:
                        s2[nowh+i][noww+j] = s2[nowh][noww]
                        d.appendleft([nowh+i, noww+j])
        for i in [-2,-1,0,1,2]:
            for j in [-2,-1,0,1,2]:
                if ((0 <= nowh+i < h) and (0 <= noww+j < w)):
                    if s2[nowh+i][noww+j] == '.':
                        s2[nowh+i][noww+j] = s2[nowh][noww]+1
                        d.append([nowh+i, noww+j])
                    elif s2[nowh+i][noww+j] != '#':
                        if s2[nowh+i][noww+j] > s2[nowh][noww]+1:
                            s2[nowh+i][noww+j] = s2[nowh][noww]+1
                            d.append([nowh+i, noww+j])
    print(-1)
 
 
if __name__ == '__main__':
    main()
n, k = map(int, input().split())
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7

plus = []
minus = []
zero = []
for i in range(n):
    if a[i] < 0:
        minus.append(abs(a[i]))
    elif a[i] > 0:
        plus.append(a[i])
    else:
        zero.append(0)


len_p = len(plus)
len_m = len(minus)
len_z = len(zero)

is_z = False
is_p = False
if len_z != 0:
    is_z = True

cnt = 2 * (len_m // 2) + len_p
if cnt >= k:
    is_p = True
if len_p == 0 and k % 2 == 1:
    is_p = False

if is_p:
    minus = sorted(minus, reverse=True)
    plus = sorted(plus, reverse=True)
    ans = 1
    if k % 2 == 1:
        k -= 1
        ans = plus[0]
        del plus[0]
    tmp = []
    for i in range(len(minus) // 2):
        tmp.append(minus[2 * i] * minus[2 * i + 1])
    for i in range(len(plus) // 2):
        tmp.append(plus[2 * i] * plus[2 * i + 1])
    tmp = sorted(tmp, reverse=True)
    for i in range(k // 2):
        ans *= tmp[i]
        ans %= MOD
    print(ans)
    exit()

elif is_z:
    print(0)
    exit()

else:
    minus = sorted(minus)
    ans = -1
    for i in range(k):
        ans *= minus[i]
        ans %= MOD
    print(ans)
    exit()


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7

plus = []
minus = []
zero = []
for i in range(n):
    if a[i] < 0:
        minus.append(abs(a[i]))
    elif a[i] > 0:
        plus.append(a[i])
    else:
        zero.append(0)


len_p = len(plus)
len_m = len(minus)
len_z = len(zero)

is_z = False
is_p = False
if len_z != 0:
    is_z = True

cnt = 2 * (len_m // 2) + len_p
if cnt >= k:
    is_p = True
if len_p == 0 and k % 2 == 1:
    is_p = False

if is_p:
    minus = sorted(minus, reverse=True)
    plus = sorted(plus, reverse=True)
    ans = 1
    if k % 2 == 1:
        k -= 1
        ans = plus[0]
        del plus[0]
    tmp = []
    for i in range(len(minus) // 2):
        tmp.append(minus[2 * i] * minus[2 * i + 1])
    for i in range(len(plus) // 2):
        tmp.append(plus[2 * i] * plus[2 * i + 1])
    tmp = sorted(tmp, reverse=True)
    for i in range(k // 2):
        ans *= tmp[i]
        ans %= MOD
    print(ans)
    exit()

elif is_z:
    print(0)
    exit()

else:
    for i in plus:
        minus.append(i)
    minus = sorted(minus)
    ans = -1
    for i in range(k):
        ans *= minus[i]
        ans %= MOD
    print(ans)
    exit()
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(6,[["khabarovsk",-20, 1], ["moscow",-10, 2], ["kazan",-50, 3], ["kazan",-35, 4], ["moscow",-60, 5], ["khabarovsk",-40, 6]])
    3
    4
    6
    1
    5
    2
    >>> print_ans(10, [["yakutsk", -10, 1 ], ["yakutsk", -20, 2 ], ["yakutsk", -30, 3 ], ["yakutsk", -40, 4 ], ["yakutsk", -50, 5 ], ["yakutsk", -60, 6 ], ["yakutsk", -70, 7 ], ["yakutsk", -80, 8 ], ["yakutsk", -90, 9 ], ["yakutsk", -100,10]])
    10
    9
    8
    7
    6
    5
    4
    3
    2
    1
    """
    ans = sorted(ar)
    for a in ans:
        print(a[2])

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = []
    for i in range(N):
        s, p = input().rstrip().split()
        n = int(n)
        ar.append((s, -n, i + 1))
    print_ans(N, ar)




### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(6,[["khabarovsk",-20, 1], ["moscow",-10, 2], ["kazan",-50, 3], ["kazan",-35, 4], ["moscow",-60, 5], ["khabarovsk",-40, 6]])
    3
    4
    6
    1
    5
    2
    >>> print_ans(10, [["yakutsk", -10, 1 ], ["yakutsk", -20, 2 ], ["yakutsk", -30, 3 ], ["yakutsk", -40, 4 ], ["yakutsk", -50, 5 ], ["yakutsk", -60, 6 ], ["yakutsk", -70, 7 ], ["yakutsk", -80, 8 ], ["yakutsk", -90, 9 ], ["yakutsk", -100,10]])
    10
    9
    8
    7
    6
    5
    4
    3
    2
    1
    """
    ans = sorted(ar)
    for a in ans:
        print(a[2])

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = []
    for i in range(N):
        s, p = input().rstrip().split()
        p = int(p)
        ar.append([s, -p, i + 1])
    print_ans(N, ar)
print(dfs(0,s[0]))

### FIXED CODE ###

s=input()
n=len(s)

def f(i,t):
    if i == n-1:
        return sum(list(map(int, t.split('+'))))
    
    return f(i+1,t+s[i+1]) + f(i+1,t+'+'+s[i+1]) #sumの値を足してる

print(f(0,s[0]))
N = input()
D=[]*N
D=map(int,input().split(" "))
sum=0
for i,di in enumerate(D):
    for j,jd in enumerate(D):
        if i!=j:
            sum+=jd*id
print(sum)

### FIXED CODE ###

import itertools
N = int(input())
D=[]*N
D=map(int,input().split(" "))
sum=0
for i,j in itertools.permutations(D,2):
    sum+=i*j

print(int(sum/2))
import sys
import numpy as np


def main():
    n = int(input())
    balls = [[int(e) for e in input().split()] for _ in range(n)]
    diff = {}
    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            if ((balls[i][0] - balls[j][0]), (balls[i][1] - balls[j][1])) in diff:
                diff[((balls[i][0] - balls[j][0]), (balls[i][1] - balls[j][1]))] += 1
            else:
                diff[((balls[i][0] - balls[j][0]), (balls[i][1] - balls[j][1]))] = 1
    print(n - max(diff.values()))


main()


### FIXED CODE ###

import sys
import numpy as np


def main():
    n = int(input())
    balls = [[int(e) for e in input().split()] for _ in range(n)]
    if n == 1:
        print(n)
        sys.exit()
    diff = {}
    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            if ((balls[i][0] - balls[j][0]), (balls[i][1] - balls[j][1])) in diff:
                diff[((balls[i][0] - balls[j][0]), (balls[i][1] - balls[j][1]))] += 1
            else:
                diff[((balls[i][0] - balls[j][0]), (balls[i][1] - balls[j][1]))] = 1
    print(n - max(diff.values()))


main()
N = int(input())
X = input().strip()
C = X.count("1")
D = int(X, 2)

p = [0]*(N+1)
for i in range(1, len(p)):
    n = i
    while True:
        b = bin(n).count("1")
        if b <= 0:
            break
        n = n % b
        p[i] += 1

for i in range(1, N+1):
    d = D
    c = C
    if X[i-1] == "1":
        c -= 1
        d -= 1 << (N-i)
    else:
        c += 1
        d += 1 << (N-i)

    d = d % c
    print(p[d]+1)


### FIXED CODE ###

N = int(input())
X = input().strip()
C = X.count("1")
D = int(X, 2)
Mm, Mp = 0, D % (C+1)
if C > 1:
    Mm = D % (C-1)

p = [0]*(2*10**5+2)
for i in range(1, len(p)):
    n = i
    while True:
        b = bin(n).count("1")
        if b <= 0:
            break
        p[i] += 1
        n = n % b

for i in range(1, N+1):
    c = C
    if X[i-1] == "1":
        c -= 1
        if c == 0:
            print(0)
            continue
        m = Mm
        d = pow(2, N-i, c)
        d = (m-d+c) % c
    else:
        c += 1
        m = Mp
        d = pow(2, N-i, c)
        d = (m+d) % c

    print(p[d]+1)
n=int(input())
a=sorted(list(map(int,input().split())))

l=[0]*(100005)
for i in range(n):
    if l[a[i]]==1:
        l[a[i]]+=1

    if l[a[i]]==0:
        for j in range(100000//a[i]):
            l[a[i]*j]+=1
    
cnt=0
for i in range(n):
    if l[a[i]]==1:
        cnt+=1
print(cnt)
            
        

### FIXED CODE ###

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

l=[0]*(1000005)
for i in range(n):
    if l[a[i]]==1:
        l[a[i]]+=1

    if l[a[i]]==0:
        for j in range(1000000//a[i]+1):
            l[a[i]*j]+=1
    
cnt=0
for i in range(n):
    if l[a[i]]==1:
        cnt+=1
print(cnt)
n = int(input())
h = list(map(int,input().split()))
ans = 1
for i in range(1,n):
    flag = 1
    for j in range(i):
        if h[j] > h[i]:
            flag = 0
            break
        else:
            pass
    if flag:
        ans += 1
print(ans)


### FIXED CODE ###

a,b = list(map(int,input().split()))
s = 0
if a >= b:
    s += a
    a -= 1
else:
    s += b
    b -= 1
s += max(a,b)
print(s)
n,a,b=map(int, input().split())
*p,=map(int, input().split())
mn,md,mx=0,0,0
for pi in p:
    if pi<=a:
        mn+=1
    elif pi<=b:
        md+=1
    else:
        mx+=1
print(min(mn,md,mx))


### FIXED CODE ###

n=int(input())
a,b=map(int, input().split())
*p,=map(int, input().split())
mn,md,mx=0,0,0
for pi in p:
    if pi<=a:
        mn+=1
    elif pi<=b:
        md+=1
    else:
        mx+=1
print(min(mn,md,mx))
N, K = map(int, input().split())
city_list = list(map(int, input().split()))
th_list = []
n = 0
count = 0
for i in range(N):
    count += 1
    th_list.append(n)
#   print(n)
    n = city_list[n] - 1
''' if n in th_list:
        #繰り返されている個数を出す
        num = len(th_list)-th_list.index(n)
        break'''
 
#print(city_list, th_list)
count = -1
for i in range(N):
    if th_list.count(th_list[i]) > 1:
        break
list = [x for x, l in enumerate(th_list) if l == th_list[i]]
#print(list)
#print(list[0])
#print(th_list)
if K > N:
    print(th_list[(K-list[0])%(list[1]-list[0])+list[0]]+1)
else:
    print(th_list[K]+1)

### FIXED CODE ###

S = input()
T = input()
x = [chr(i) for i in range(97, 97+26)]
list = []
for i in range(26):
    list.append(S+x[i])
if T in list:
    print("Yes")
else:
    print("No")
S = list(input())

for i in range(len(S)):
  n = ord(S[i])
  if ord('z') - n + 1 >= K:
    K -= ord('z') - n + 1
   	S[i] = 'a'

if K != 0:
  n = ord(S[-1])
  n -= ord('a')
  n += K
  n %= ord('z') - ord('a')
  n += ord('a')
  S[-1] = chr(n)
print(''.join(S))
    
    

### FIXED CODE ###

S = list(input())
K = int(input())

for i in range(len(S)):
  n = ord(S[i])
  if S[i] == 'a':
    continue
  if ord('z') - n + 1 <= K:
    K -= ord('z') - n + 1
    S[i] = 'a'
assert K >= 0
if K != 0:
  n = ord(S[-1])
  n -= ord('a')
  n += K
  n %= 26
  n += ord('a')
  S[-1] = chr(n)
print(''.join(S))
N = input().split()

if N%2 == 0:
    ans = 0.5
else:
    ans = (N+1)/(2*N)

print(ans)

### FIXED CODE ###

a = input().split()
N = int(a[0])
ans = 0.5
if N%2 == 0:
    pass
else:
    ans = (N+1)/(2*N)

print(ans)
a,b,c,d=map(int,input().split())
import math
e=(c*d)//math.gcd(c,d)
ans=(b-a+1)-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//e-(a-1)//e)
print(ans)

### FIXED CODE ###

a,b,c,d=map(int,input().split())
import fractions
e=(c*d)//fractions.gcd(c,d)
ans=(b-a+1)-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//e-(a-1)//e)
print(ans)
from sys import stdin,stdout
from collections import defaultdict
def dfs1(src):
    global steps
    if steps>rem:return src
    steps+=1
    return dfs1(g[src][0])
def dfs(src):
    global steps,done,boc,nic
    vis[src]=1
    steps+=1
    dfn[src]=steps
    for neigh in g[src]:
        if not vis[neigh]:dfs(neigh)
        else:
            boc,done,nic=[neigh,steps,steps-dfn[neigh]+1]
            # print(done,boc,nic)
            return

n,k=list(map(int,stdin.readline().split()))
done,boc,nic=0,0,0
a=list(map(int,stdin.readline().split()))
g=defaultdict(list)
for i in range(1,n+1):
    g[i]+=[a[i-1]]
vis=[0]*(n+1)
dfn=[0]*(1+n)
steps=0
dfs(1)
# print(done,boc,nic)
left=k-done
rem=(left%nic)
if rem==0:rem=nic
steps=1
print(dfs1(boc))

### FIXED CODE ###

from sys import stdin,stdout
from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)
def dfs1(src):
    global steps
    if steps==rem:return src
    steps+=1
    return dfs1(g[src][0])
def dfs(src):
    global steps,done,boc,nic
    vis[src]=1
    steps+=1
    if steps-1==k:
        print(src)
        exit(0)
    dfn[src]=steps
    for neigh in g[src]:
        if not vis[neigh]:dfs(neigh)
        else:
            boc,done,nic=[neigh,steps,steps-dfn[neigh]+1]
            # print(done,boc,nic)
            return

n,k=list(map(int,stdin.readline().split()))
done,boc,nic=0,0,0
a=list(map(int,stdin.readline().split()))
g=defaultdict(list)
for i in range(1,n+1):
    g[i]+=[a[i-1]]
vis=[0]*(n+1)
dfn=[0]*(1+n)
steps=0
dfs(1)
# print(done,boc,nic)
left=k-done
rem=(left%nic)
if rem==0:rem=nic
steps=1
print(dfs1(g[boc][0]))
heightOfMountains = []
for i in range(1, 11):
	heightOfMountains.append(int(input()))
sort.heightOfMountains
for i in range(1, 4):
	print(heightOfMountains[-j])

### FIXED CODE ###

heightOfMountains = []
for i in range(1, 11):
	heightOfMountains.append(int(input()))
heightOfMountains.sort()
for i in range(1, 4):
	print(heightOfMountains[-i])
A=[]
while True:
    try:
        A.append(list(map(int,input().split())))
              

    except:
        break;
#2列めがT以下で且つ、コストが最小なものを抽出
min = A[1][1] #最小を7とす

for i in range(1, len(A)):
  j = int(i)
  if A[j][1] =< A[0][1]:
    if A[j][0] < min:
      min = A[j][0]

if min < A[0][1]:
  print(min)
else:
  print("TLE")
    

### FIXED CODE ###

A=[]
while True:
    try:
        A.append(list(map(int,input().split())))
              
 
    except:
        break;
#2列めがT以下で且つ、コストが最小なものを抽出
T = A[0][1]
Tc = 0
min = A[1][0] #最小を7とす
 
for i in range(1, len(A)):
  j = int(i)
  if A[j][1] <= T:
    Tc = Tc+1
    if A[j][0] <= min:
      min = A[j][0]
     
      
if Tc == 0:
  print("TLE")
else:
  print(min)
def mod_inv(n: int, mod: int)->int:
    b, u, v = mod, 1, 0
    while b > 0:
        t = n // b

        n -= t * b
        u -= t * v

        a, b = b, a
        u, v = v, u

    return (u+mod) % mod


def _11(N: int, A: list)->list:
    MOD = 10**9 + 7

    d = {}
    l, r = 0, 0
    for i, a in enumerate(A):
        if a in d:
            l, r = d[a], N-i
        else:
            d[a] = i

    c1, c2 = [1]*(N+2), [1]*(N+2)
    for i in range(N+1):
        c1[i+1] = (c1[i] * (N+1-i) * mod_inv(i+1, MOD)) % MOD
        c2[i+1] = (c2[i] * (l+r-i) * mod_inv(i+1, MOD)) % MOD

    return [(c1[k+1]-c2[k]+MOD) % MOD for k in range(N+1)]


if __name__ == "__main__":
    N = int(input())
    A = [int(s) for s in input().split()]
    ans = _11(N, A)
    print('\n'.join(map(str, ans)))


### FIXED CODE ###

def mod_inv(n: int, mod: int)->int:
    b, u, v = mod, 1, 0
    while b > 0:
        t = n // b

        n -= t * b
        u -= t * v

        n, b = b, n
        u, v = v, u

    return (u+mod) % mod


def _11(N: int, A: list)->list:
    MOD = 10**9 + 7

    d = {}
    l, r = 0, 0
    for i, a in enumerate(A):
        if a in d:
            l, r = d[a], N-i
        else:
            d[a] = i

    c1, c2 = [1]*(N+2), [1]*(N+2)
    for i in range(N+1):
        c1[i+1] = (c1[i] * (N+1-i) * mod_inv(i+1, MOD)) % MOD
        c2[i+1] = (c2[i] * (l+r-i) * mod_inv(i+1, MOD)) % MOD

    return [(c1[k+1]-c2[k]+MOD) % MOD for k in range(N+1)]


if __name__ == "__main__":
    N = int(input())
    A = [int(s) for s in input().split()]
    ans = _11(N, A)
    print('\n'.join(map(str, ans)))
n, y = map(int, input().split())
b = [-1, -1, -1]
count = 0
for i in range(n + 1):
  for j in range(n + 1):
    k = n - i - j
    if k < 0:
      break
    total = 10000 * i + 5000 * j + 1000 * k
    count += 1
    if total == y and (i + j + k) == n:
      b = [i, j, k]
      break
print(b)

### FIXED CODE ###

s = input()
print('2018' + s[4:])
i = input()
ar = i.split()
print(max(ar[0]-2*ar[1], 0))


### FIXED CODE ###

i = input()
ar = i.split()
print(max(int(ar[0])-2*int(ar[1]), 0))
#!/usr/bin/env python
# coding: utf-8

N, T = map(int, raw_input().split(' '))
t = map(int, raw_input().split(' '))
assert len(t) == N

begin = t[0]
end = t[0] + T
for i in range(N):
    if t[i] <= end:
        end = t[i] + T
    else:
        sum += (end - begin)
        begin = t[i]
        end = t[i] + T

sum += (end - begin)
print sum


### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

N, T = map(int, raw_input().split(' '))
t = map(int, raw_input().split(' '))
assert len(t) == N

sum_ = 0
begin = t[0]
end = t[0] + T
for i in range(N):
    if t[i] <= end:
        end = t[i] + T
    else:
        sum_ += (end - begin)
        begin = t[i]
        end = t[i] + T

sum_ += (end - begin)
print sum_
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

 #最小公倍数
def lcm(a,b):
    return a*b/gcd(a,b)
  
A,B,C,D=map(int,input().split())

if A%C == 0:
    AC = int(A/C) - 1
else:
    AC = int(A/C)
if A%D == 0:
    AD = int(A/D) - 1
else:
    AD = int(A/D)
    
lcmCD = lcm(C,D)
if A%(lcmCD) == 0:
    ACD = int(A/(lcmCD)) - 1
else:
    ACD = int(A/(lcmCD))
    
print((B - A + 1) - (int(B/C) - AC + int(B/D) - AD - int(B/(lcmCD) + ACD)))

### FIXED CODE ###

a = input()
lena = len(a)
bad = False
aft = 0

for i in a:
    bef = i
    if bef==aft:
        bad = True
        break
    else:
        aft=bef
if bad==True:
    print('Bad')
else:
    print('Good')
N = int(input())
a = list(map(int, input().split()))

a.sort(reversed=True)

for i in range(N):
    Alice = 0
    Bob = 0
    if N % 2 == 0:
        Alice += list[i]
    else:
        Bob += list[i]

print("{}".format(Alice - Bob))

### FIXED CODE ###

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

a.sort(reverse=True)

Alice = 0
Bob = 0

for i in range(N):
    if i % 2 == 0:
        Alice += a[i]
    else:
        Bob += a[i]

print("{}".format(Alice - Bob))
print(eval(int,input().replace(" ","+"))%24)

### FIXED CODE ###

print(sum(map(int,input().split()))%24)
N=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(0,N+1,2):
  if A[i]%2!=0:
    ans+=1
print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(0,N,2):
  if A[i]%2==1:
    ans+=1
print(ans)
m = input()

#000 = 0
#001 = 1
#011 = 2
#111 = 3
print(f"{int(m[0])+int(m[1])+int(m[2])}")

### FIXED CODE ###

m = input()
a = int(m[0]) + int(m[1]) + int(m[2])
print (a)