Harryxun/stf_run huggingface dataset:
def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
  if len(splitted) == depth:
    return a + b
  else:
    # 左のdfs() 呼び出し -> +を挿入しなかったとき
    # 右のdfs() 呼び出し -> +を挿入したとき
    return dfs(splitted, a, b * 10, depth + 1) + dfs(splitted, a + b, splitted[i], depth + 1)

s = [int(x) for x in input()]
print(dfs(s, 0, 0, 0))

### FIXED CODE ###

s = input()
result_sum = 0
plus_count = len(s) - 1

for bit in range(1 << plus_count):
  splitted_string = s[0]
  for iter_plus in range(plus_count):
    if bit & (1 << iter_plus):
      splitted_string += '+'
    splitted_string += s[iter_plus+1]
  result_sum += eval(splitted_string)

print(result_sum)
n=int(input())
s=list(input())
k=int(input())
p=s[k]
for i in range(n):
    if s[i]!=p:
        s[i]='*'
print(''.join(s))

### FIXED CODE ###

n=int(input())
s=list(input())
k=int(input())
p=s[k-1]

for i in range(n):
    if s[i]!=p:
        s[i]='*'
print(''.join(s))
n = input()

if len(n) == 2:
    print(n)
else if len(n) == 3:
    print(n[::-1])

### FIXED CODE ###

n = input()

if len(n) == 2:
    print(n)
elif len(n) == 3:
    print(n[::-1])
a = input()
b = input()
h = input()

area = (a + b)*h/2

print(area)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2)
a = [[], []]
[a[i%2].append(t) for i, t in enumerate(map(int, input().split()))]
print(sum([(lambda x: len(x) -max([x.count(xi) for xi in x]))(ai) for ai in a]))

### FIXED CODE ###

N = int(input())
a = [[],[]]
[a[i%2].append(t) for i, t in enumerate(map(int, input().split()))]

a_cnt = [{},{}]
for i in range(2):
    for j in range(len(a[i])):
        if a[i][j] in a_cnt[i]:
            a_cnt[i][a[i][j]] += 1
        else:
            a_cnt[i][a[i][j]] = 1

for i in range(2):
    # print(list(a_cnt[i].items()))
    a_cnt[i] = list(sorted(list(a_cnt[i].items()),\
        key=(lambda x:x[1]), reverse=True))[:2]

# print(a_cnt)
if a_cnt[0][0][0] != a_cnt[1][0][0]:
    print(N -a_cnt[0][0][1] -a_cnt[1][0][1])
else:
    if len(a_cnt[0])==1 and len(a_cnt[1])==1:
        print(N//2)
    else:
        ans1 = N -a_cnt[0][0][1] -a_cnt[1][1][1]
        ans2 = N -a_cnt[0][1][1] -a_cnt[1][0][1]
        print(min(ans1, ans2))
from itertools import accumulate
from bisect import bisect

n, m, k = map(int, input().split())
a = [*accumulate(map(int, input().split()), initial=0)]
b = [*accumulate(map(int, input().split()), initial=0)]
ans = 0
for i, x in enumerate(a):
    if x <= k:
        ans = max(i - 1 + bisect(b, k - x))
print(ans)


### FIXED CODE ###

from itertools import accumulate
from bisect import bisect

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = [0] + list(accumulate(a))
b = [0] + list(accumulate(b))
ans = 0
j = m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
n, k = map(int, input().split())
*p, = map(int, input().split())
p = [v - 1 for v in p]
*c, = map(int, input().split())
minc = float('-inf')

ans = minc


def get_loop(i):
    pos = i
    cnt = 0
    cur_score = 0
    while cnt == 0 or pos != i:
        pos = p[pos]
        cur_score = cur_score + c[pos]
        cnt += 1
    return cnt, cur_score

# print(get_loop(2))

def solve(pos, k):
    score = minc
    cur_score = 0
    loop_length, loop_score = get_loop(pos)
    if k >= 2 * loop_length and loop_score > 0:
        # print("%s: %s // %s, %s, %s" % (i, k, loop_length, cur_score, max_loop_score))
        cur_score = loop_score * ((k - loop_length) // loop_length)
        score = max(cur_score, score)
        k = k % loop_length + loop_length
    else:
        k = min(k, 2 * loop_length)
    for _ in range(k):
        pos = p[pos]
        cur_score += c[pos]
        score = max(cur_score, score)
    # print("%s: %s" % (i, score))
    return score

for i in range(n):
    ans = max(ans, solve(i, k))
print(ans)



### FIXED CODE ###

import sys
import time
s1 = time.time()
*data, = map(int, sys.stdin.read().split()[::-1])

def inp():
    global data
    return data.pop()
R, C, k = inp(), inp(), inp()
grid = [[0] * C for _ in range(R)]

for _ in range(k):
    ri, ci, v = inp(), inp(), inp()
    grid[ri - 1][ci - 1] = v


dp = []
for _ in range(4):
    dp.append([[0] * (C + 1) for _ in range(R + 1)])

# print(time.time() - s1)
mx = 0
for row in range(1, R + 1):
    for col in range(1, C + 1):
        level = 0
        dp[1][row][col] = max(dp[1][row][col], dp[3][row - 1][col] + grid[row - 1][col - 1])
        dp[0][row][col] = max(dp[0][row][col], dp[3][row - 1][col])
        level = 1
        v = grid[row - 1][col - 1]
        while level < 4:
            dp[level][row][col] = max(
                dp[level - 1][row][col],
                dp[level][row][col],
                dp[level][row][col - 1],
                dp[level - 1][row][col - 1] + v,
            )
            mx = max(mx, dp[level][row][col])
            level += 1

# print(time.time() - s1)
print(mx)
n, p = map(int, input().split())
S = list(map(int, list(input())))

MOD = p

mods = [0 for _ in range(2019)]
mods[0] = 1

num = 0
digit = 1
for s in S[::-1]:
  num = s * digit + num
  num %= MOD
  mods[num] += 1
  digit = (digit * 10) % MOD
  
ans = 0
for m in mods:
  ans += m * (m - 1) // 2

print(ans)


### FIXED CODE ###

n, p = map(int, input().split())
S = list(map(int, list(input())))

if p == 2 or p == 5:
  ans = 0
  for i, x in enumerate(S[::-1]):
    if x % p == 0:
      ans += n - i
else:
  mods = [0 for _ in range(p)]
  mods[0] = 1

  num = 0
  digit = 1
  for s in S[::-1]:
    num = (s * digit + num) % p
    mods[num] += 1
    digit = (digit * 10) % p
  
  ans = 0
  for m in mods:
    ans += m * (m - 1) // 2

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

plug = 1
tap = 0

for i in range(20):
    if plug >= B:
        break
    else:
        prug += A - 1 and tap += 1

print(tap)

### FIXED CODE ###

S = input()
T = input()

result = 0
for i in range(0,3):
    if S[i] == T[i]:
        result += 1

print (result)
import itertools

H,W = map(int,input().split())
S = [list(map(int,input().split())) for _ in range(H)]

VALID = [[False] * W for _ in range(H)]

def dfs(h,w,parent):
  if parent:
    VALID[h][w] = True

  nxt = [-1,0,1]
  ok = False
  for x,y in itertools.product(nxt,repeat=2):
    if not (abs(x) + abs(y) == 1):
      continue
    nx = h + x
    ny = w + y
    if 0 <= nx < H and 0 <= ny < W and S[nx][ny] == '#':
      ok = True
      dfs(nx,ny,True)
  
  if not parent and ok:
    VALID[h][w] = True
      
for i in range(H):
  for j in range(W):
    if S[i][j] == '.':
      VALID[i][j] = True
    else:
      if not VALID[i][j]:
        dfs(i,j,False)
        
if all(sum(VALID,[])):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

import itertools

H,W = map(int,input().split())
S = [list(input()) for _ in range(H)]

ok = True        
for i in range(H):
  for j in range(W):
    if S[i][j] == '#':
      flg = False
      for x,y in itertools.product([-1,0,1],repeat=2):
        if not (abs(x) + abs(y) == 1):
          continue
        nx = i + x;ny = j + y
        if 0 <= nx < H and 0 <= ny < W:
          if S[nx][ny] == '#':
            flg = True
      if not flg:
        ok = False
        break
if ok:
  print('Yes')
else:
  print('No')
a,b,c=map(int,input().split())
while k=0:
  k-=1
  a-=1
  b-=1
print(a,b)

  

### FIXED CODE ###

A,B,K=map(int,input().split())
if A-K>=0:
  print(A-K,B)
else:
  B=B-(K-A)
  if B<=0:
    print(0,0)
  else:
    print(0,B)
N=int(input())
S=list(input())
check=[]
for i in range(N-1):
  if S[i]==S[i+1]:
    check.append(i)
reversed(check)
for i in check:
  S.pop(i)


### FIXED CODE ###

N=int(input())
S=list(input())
check=[]
for i in range(N-1):
  if S[i]==S[i+1]:
    check.append(i)
check=reversed(check)
for i in check:
  S.pop(i)
print(len(S))
N = input()
print('Yes' if 7 in N else 'No')


### FIXED CODE ###

N = input()
print('Yes' if '7' in N else 'No')
from math import factorial

def combination(n, k, MOD):
    return(factorial(n) // (factorial(n-k) * factorial(k))) % MOD


def main():
    N, K = map(int, input().split())
    MOD = 10**9+7
    for i in range(1,K+1):
        print(combination(N - K + 1, i,MOD) * combination(K - 1, i - 1,MOD) % MOD)

if __name__ == "__main__":
    main()




### FIXED CODE ###

def fuctorial(n):
    ret = 1
    while n > 0:
        ret *= n
        n -= 1
    return ret

def combination(n, k, MOD):
    return (fuctorial(n) // (fuctorial(n-k) * fuctorial(k)))%MOD


def main():
    N, K = map(int, input().split())
    MOD = 10**9+7
    for i in range(1, K + 1):
        if i > N - K + 1:
            print(0)
        else:
            print(combination(N - K + 1, i,MOD) * combination(K - 1, i - 1,MOD) % MOD)

if __name__ == "__main__":
    main()
import math
a, b, x = map(int, input().split())
t = (a ** 3) / (2 * (a ** 2 * b - x))
if t >= (a / b):
    print(90 - (math.atan(t) / (math.pi)) * 180)
else:
    print(90 - (math.atan(x / (a * b * b)) / math.pi) * 180)

### FIXED CODE ###

import math
a, b, x = map(int, input().split())
if (a ** 2 * b - x) > 0:
    t = (a ** 3) / (2 * (a ** 2 * b - x))
    if t >= (a / b):
        print(90 - (math.atan(t) / (math.pi)) * 180)
    else:
        print((math.atan(a * b * b / (2 * x)) / math.pi) * 180)
else:
    print(0)
x=()
y=()
z=int(x)*int(y)
l=int(x)+int(y)
print(z l)

### FIXED CODE ###

z= input()
x, y = z.split()

m = int(x)*int(y)
l = int(x)*2+int(y)*2
print('{} {}'.format(m,l))
n = input()

search_list = [str(x) * 3 for x in range(1,10)]
for i in search_list:
    if i in n:
        print('Yes')
        break
else:
    print(No)

### FIXED CODE ###

n = input()
search_list = [str(x) * 3 for x in range(0,10)]
for i in search_list:
    if i in n:
        print('Yes')
        break
else:
    print("No")
import math

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

def waribiki(s,maisu):
    return math.floor(s/(2**maisu))

for _ in range(m):
    a.append(waribiki(max(A)),1))
    a.remove(max(a))

print(sum(a))

### FIXED CODE ###

import heapq
n,m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)
 
for i in range(m):
	target = heapq.heappop(a)
	heapq.heappush(a, (-1)*(-target//2))
	
print(-sum(a))
N,M=map(int,input().split())

pair=[list(map(lambda x:int(x)-1,input().split())) for _ in range(M)]
graph=[[0]*N for _ in range(N)] #隣接行列の初期化

print(pair)

for p in pair:
	graph[p[0]][p[1]]= graph[p[1]][p[0]]=1
	
def DFS(v):
	if visited[v]:
		return 
	visited[v]=True
	for i in [i for i,v2 in enumerate(graph[v]) if v2==1]:
		DFS(i)
		
res = 0

for i in range(M):
	visited=[False for _ in range(N)] #訪問済みリストの初期化
	x,y=pair[i]
	graph[x][y]=graph[y][x]=0 #辺を取り除く
	DFS(0)
#	DFS(0 if i>0 else 1)
	
	if not all(visited): #全ての頂点が訪問済みでなかった場合
		res+=1
	
	graph[x][y]=graph[y][x]=1

print(res)

### FIXED CODE ###

A,B,C=list(input().split())

if A==B:
	print(C)
elif B==C:
	print(A)
else:
	print(B)
import sys

sys.setrecursionlimit(10**5)

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

counter = 0
c = [-1 for i in range(n)]
p = [[] for n in range(n)]

for i in range(m):
    x, y, z = list(map(int, input().split()))
    x -= 1
    y -= 1
    p[x].append(y)
    p[y].append(x)

def dfs(num, depth):
    if c[num] != -1:
        return
    else:
        c[num] = depth
    for i in p[num]:
        dfs(i, depth)

for i in range(n):
    if c[i] == -1:
        counter += 1
        dfs(i, counter)

print(max(c))

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6)

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

counter = 0
c = [-1 for i in range(n)]
p = [[] for n in range(n)]

for i in range(m):
    x, y, z = list(map(int, input().split()))
    x -= 1
    y -= 1
    p[x].append(y)
    p[y].append(x)

def dfs(num, depth):
    if c[num] != -1:
        return
    else:
        c[num] = depth
    for i in p[num]:
        dfs(i, depth)

for i in range(n):
    if c[i] == -1:
        counter += 1
        dfs(i, counter)

print(max(c))
import sys

class UnionFind():
    def __init__(self, N):
        self.N = N
        self.par = [n for n in range(N)]
        self.rank = [0 for _ in range(N)]

    def find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def union(self, x, y):
        x = self.par[x]
        y = self.par[y]
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def isSame(self, x, y):
        return self.par[x] == self.par[y]

    def refresh(self):
        for p in range(N):
            self.find(p)

N, K, L = [int(x) for x in input().strip().split()]
road = UnionFind(N)
train = UnionFind(N)

for ｋ in range(K):
    p, q = [int(x) - 1 for x in input().strip().split()]
    road.union(p, q)
for l in range(L):
    r, s = [int(x) - 1 for x in input().strip().split()]
    train.union(r, s)

road.refresh()
train.refresh()

ans = [1] * N
for i in range(N - 1):
    for j in range(i + 1, N):
        if i == j:
            continue
        if road.par[i] == road.par[j] and train.par[i] == train.par[j]:
            ans[i] += 1
            ans[j] += 1

print(*ans)

### FIXED CODE ###

import sys
from collections import defaultdict
sys.setrecursionlimit(10**7)

N, K, L = [int(x) for x in input().strip().split()]
road_par = [n for n in range(N)]
road_rank = [0 for _ in range(N)]
train_par = [n for n in range(N)]
train_rank = [0 for _ in range(N)]

def find(par, x):
    if par[x] == x:
        return x
    par[x] = find(par, par[x])
    return par[x]

def union(par, rank, x, y):
    x = find(par, par[x])
    y = find(par, par[y])
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

for ｋ in range(K):
    p, q = [int(x) - 1 for x in input().strip().split()]
    union(road_par, road_rank, p, q)
for l in range(L):
    r, s = [int(x) - 1 for x in input().strip().split()]
    union(train_par, train_rank, r, s)

d = defaultdict(int)
for n in range(N):
    r = find(road_par, n)
    t = find(train_par, n)
    d[(r, t)] += 1

for n in range(N):
    print(d[(road_par[n], train_par[n])], end=' ')
N, M = map(int, input().split())
if N >= M:
  	print(0)
else:
	X = list(map(int, input().split()))
	X = sorted(X)
	L = []
	for i in range(0, M-1):
    	L.append(X[i+1] - X[i])
	L = sorted(L, reverse = True)
	S = 0
	for i in range(N-1):
    	S += L[i]
	res = X[M-1] - X[0] - S
	print(res)

### FIXED CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))
if N >= M:
    print(0)
else:
    X = sorted(X)
    L = []
    for i in range(0, M-1):
        L.append(X[i+1] - X[i])
    L = sorted(L, reverse = True)
    S = 0
    for i in range(N-1):
        S += L[i]
    res = X[M-1] - X[0] - S
    print(res)
N = int(input())
if N%2==0:
    a=N//2
    b=N
    c=N
    print(a,b,c)
else:
    for ai in range(N//4,3500):
        for bi in range(N//4,3500):
            ci = N*ai*bi/(4*ai*bi-N*ai-N*bi)
            if ci == int(ci) and ci > 0:
                print(ai,bi,int(ci))
                exit()
                


### FIXED CODE ###

N = int(input())
for ai in range(1,3500):
    for bi in range(1,3500):
        try:
            ci = N*ai*bi/(4*ai*bi-N*ai-N*bi)
        except:
            continue
        if ci == int(ci) and ci > 0:
            print(ai,bi,int(ci))
            exit()
X,N = map(int,input().split())
P = [int(i) for i in input().split()]
for i in range(1,101):
    if i in P:
        pass
    else:
        if "ans" in locals():
          if abs(X-ans) > abs(X-i):
            ans = i
        else:
            ans = i
print(ans) if N != 0 else print(X)


### FIXED CODE ###

X,N = map(int,input().split())
P = [int(i) for i in input().split()]
ans = 100000
flag = False
for i in range(-1,102):
    if i in P:
        pass
    else:
        if abs(X - ans) > abs(X-i):
            flag = True
            ans = i
print(ans)
N, M = map(int,input().split())
a = list(map(int,input().split()))
check = []
for i in range(M):
    check.append(list(map(int,input().split())))
check.sort(key=lambda x : x[1],reverse = True)
a.sort()
ans = 0
for b, c in check:
    change = a[:b]
    a = a[b:]
    if max(change) < c:
        ans += b*c
    else:
        for i in range(len(change)):
            ans+=max(c, change[i])
        print(ans+sum(a))
        break
else:
    print(ans+sum(a))

### FIXED CODE ###

N, M = map(int,input().split())
a = list(map(int,input().split()))
check = []
for i in range(M):
    check.append(list(map(int,input().split())))
check.sort(key=lambda x : x[1],reverse = True)
a.sort()
ans = []
for b, c in check:
    ans += [c for i in range(b)]
    if len(ans) > N:
        break
else:
    ans+=[0 for i in range(N-len(ans))]
A=0
for i in range(N):
    A+=max(ans[i],a[i])
print(A)
n = int(input())
a = []
for _ in range(n) :
    a += [int(input())]
print(max(a)- min(a))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
print(max(a)- min(a))
#abc163c
n=int(input())
a=list(map(int,input().split()))
res=[0]*n
for x in a:
 res[x-1]+=1
print(*res,sep='\n')


### FIXED CODE ###

#abc163a
from math import pi
r=int(input())
print(r*pi*2)
import bisect
import sys
input = sys.stdin.readline

N = int(input())
A = [-1*int(input()) for _ in range(N)]

maxims = [A[0]]
ans = 1
minim = A[0]
for a in A[1:]:
    if maxims[-1] < a:
        idx = bisect.bisect(maxims,a)
        maxims[idx] = a
    else:
        maxims.append(a)
        ans += 1
    
print(ans)
    
    
    

### FIXED CODE ###

import bisect
import sys
input = sys.stdin.readline

N = int(input())
A = [-1*int(input()) for _ in range(N)]

maxims = [A[0]]
ans = 1
for a in A[1:]:
    if maxims[-1] > a:
        idx = bisect.bisect(maxims,a)
        maxims[idx] = a
    else:
        maxims.append(a)
        ans += 1
    
print(ans)
n = int(input())
count = 0

for i in range(n):
    s[i] = input()
    if s[i] in s:
        count += 1

print(count)

### FIXED CODE ###

# よりシンプルな解答

n = int(input())
s = [input() for _ in range(n)]

print(len(set(s)))
n,a,b = map(int, input().split())
m = 0
ans = 0
c = 0

while m < n:
    if c == 0:
        if m + a <= n:
            ans = ans + a
        else:
            ans = ans + n - m
        c = 1
        m = m + a
    else:
        c = 0
        m = m + b
    
print(ans)

### FIXED CODE ###

S = input()

if S == 'AAA' or S == 'BBB':
    print('No')
else:
    print('Yes')
A=str(input())
B=str(input())
a=list(A)
b=list(B)
t=''
for i in range(len(a)+len(b)):
  t+=a[i]+b[i]
if len(a)>len(b):
  t+=a[len(a)-1]
print(t)

### FIXED CODE ###

A=str(input())
B=str(input())
a=list(A)
b=list(B)
t=''
for i in range(len(b)):
  t+=a[i]+b[i]
if len(a)>len(b):
  t+=a[len(a)-1]
print(t)
x=input().split()

y=[0]*3
y[0]=x[0]+x[1]
y[1]=x[0]-x[1]
y[2]=x[0]*x[1]
 
print(max(y))

### FIXED CODE ###

x=input().split()

for i in range(2):
    x[i]=int(x[i])

y=[0]*3
y[0]=x[0]+x[1]
y[1]=x[0]-x[1]
y[2]=x[0]*x[1]
 
print(max(y))
from itertools import combinations
import math

ans=0
aaa=0

a,b=map(int,input().split())
c=(math.gcd(a,b))
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
s=make_divisors(c)
#print(s)
for i in s:
    aaa=0
    if i>=3:
        for j in range(2,i):
            #print(i,j)
            if i%j==0:
                aaa=1
                break
            else:
                aab=0
    if aaa==0:
        ans+=1
print(ans)

### FIXED CODE ###

from itertools import combinations
from fractions import gcd

#coding:utf8
import random

def is_prime3(q,k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
ans=0

a,b=map(int,input().split())
c=gcd(a,b)
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
s=make_divisors(c)
for i in s:
    ans=ans+is_prime3(i)
print(ans+1)
#066-D
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
d=Counter(a).most_common(1)[0][0]
f,s=-1,-1
fc=[1 for i in range(n+2)]
for i in range(n+1):
    if a[i]==d:
        if f==-1:
            f=i
        else:
            s=i
    fc[i+1]=(i+1)*fc[i]
fc[n+1]=(n+1)*fc[n]
for k in range(1,n+2):
    if k==1:
        print(n)
    elif k>f+1+n+1-s-1:
        print(int((fc[n+1]/(fc[k]*fc[n+1-k]))%(pow(10,9)+7)))
    else:
        print(int(fc[n+1]/(fc[k]*fc[n+1-k])-fc[f+n-s]/(fc[k-1]*fc[f+n-s-(k-1)])%(pow(10,9)+7)))

### FIXED CODE ###

n = int(input())
a = input().split()
a = [int(m) for m in a]
dic = {}
dic2 = {}
for i in range(n + 1):
    dic[a[i]] = 0
    dic2[a[i]] = []
f = 0
s = 0
for i in range(n + 1):
    dic[a[i]] += 1
    dic2[a[i]].append(i)
    if dic[a[i]] == 2:
        f = dic2[a[i]][0]
        s = i
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
 
mod = 10**9+7 #出力の制限
N = n + 1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
 
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
 
 
for i in range(n + 1):
    if i == 0:
        print(n)
    else:
        if f + n - s >= i:
            if (cmb(n + 1, i + 1, mod) - cmb(f + n - s, i, mod)) >= 0:
                print(cmb(n + 1, i + 1, mod) - cmb(f + n - s, i, mod))
            else:
                print(cmb(n + 1, i + 1, mod) - cmb(f + n - s, i, mod) + mod)
        else:
            print(cmb(n + 1, i + 1, mod))
N, W = map(int, input().split())

weight = [None] * N
value  = [None] * N

for i in range(N):
    w, v = map(int, input().split())
    weight[i] = w
    value[i]  = v

dp = [[None] * (W+1) for _ in range(N+1)]
for i in range(W+1):
    dp[0][i] = 0
for v in range(N):
    for w in range(1, W+1):
        if w >= weight[v]:
            dp[v+1][w] = max(dp[v][w-weight[v]] + value[v], dp[v][w])
        else:
            dp[v+1][w] = dp[v][w]
print(dp[N][W])


### FIXED CODE ###

N, W = map(int, input().split())

weight = [None] * N
value  = [None] * N

for i in range(N):
    w, v = map(int, input().split())
    weight[i] = w
    value[i]  = v

dp = [[None] * (W+1) for _ in range(N+1)]
for i in range(W+1):
    dp[0][i] = 0
for v in range(N):
    for w in range(W+1):
        if w >= weight[v]:
            dp[v+1][w] = max(dp[v][w-weight[v]] + value[v], dp[v][w])
        else:
            dp[v+1][w] = dp[v][w]
print(dp[N][W])