Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###


import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline




def acinput():
    return list(map(int, input().split(" ")))


def II():
    return int(input())

directions=np.array([[1,0],[0,1],[-1,0],[0,-1]])
directions = list(map(np.array, directions))

mod = 10**9+7


def factorial(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact



def serch(x, count):
    #print("top", x, count)
            

    for d in directions:
        nx = d+x
        #print(nx)
        if np.all(0 <= nx) and np.all(nx < (H, W)):
            if field[nx[0]][nx[1]] == "E":
                count += 1 
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)  
                continue
            if field[nx[0]][nx[1]] == "#":
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)    
                 
    return count

N,X,Y=acinput()



dist=[[-1 for j in range(N+1) ] for i in range(N+1)]


for i in range(1,N):
    for j in range(i,N+1):
        a=np.abs(i-X)
        b=np.abs(j-Y)
        dist[i][j]=min(j-i,a+b+1)
        

res=[0]*(N+1)
for i in range(N):
    for j in range(i, N+1):
        res[dist[i][j]]+=1
        

for i in range(1,N):
    print(res[i])

### FIXED CODE ###


#import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline




def acinput():
    return list(map(int, input().split(" ")))



N,X,Y=acinput()



dist=[[-1 for j in range(N+1) ] for i in range(N+1)]


for i in range(1,N):
    for j in range(i,N+1):
        a=abs(i-X)
        b=abs(j-Y)
        dist[i][j]=min(j-i,a+b+1)
        

res=[0]*(N+1)
for i in range(N):
    for j in range(i, N+1):
        res[dist[i][j]]+=1
        

for i in range(1,N):
    print(res[i])

#print(np.array(dist))
#print(res)
### BUGGY CODE ###

N = int(input())
q = [sorted(list(map(int, input().split()))) for _ in range(N-1)]

ans = 0

for l in range(1, N+1):
    ql = [q[i] for i in range(N-1) if l <= q[i][0]]
    for r in range(l, N+1):
        points = (r - l + 1)
        edges = len([qli for qli in ql if qli[1] <= r])
        res = points - edges
        ans += res

print(ans)


### FIXED CODE ###

N = int(input())
q = [sorted(list(map(int, input().split()))) for _ in range(N-1)]

ans = 0

for i in range(1, N+1):
    ans += i * (N - i + 1)
for qi in q:
    u, v = qi[0], qi[1]
    ans -= u * (N - v + 1)

print(ans)
### BUGGY CODE ###

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

for i in range(1, num+1):
    print(a.count(i))

### FIXED CODE ###

num = int(input())
a = list(map(int, input().split()))
count = [0] * num

for i in range(len(a)):
    count[a[i] - 1] += 1

for i in range(len(count)):
    print(count[i])
### BUGGY CODE ###

# ABC 065 B

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

i = 1
q = []
while i != 2:
    q.append(i)
    i = A[i-1]
    if i in q:
        print(-1)
        break
else:
    print(len(q))

### FIXED CODE ###

# ABC 065 B

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

i = 1
s = 0
while i != 2:
    s += 1
    A[i-1], i = 1, A[i-1]
    if i == 1:
        print(-1)
        break
else:
    print(s)
### BUGGY CODE ###

import sys

h, w, d = map(int, input().split())
f = [list(map(int, input().split())) for _ in range(h)]

c_map = [0] * (h * w)
for i in range(h):
    for j in range(w):
        c_map[f[i][j] - 1] = (i, j)

buf = []
q = int(input())
for line in sys.stdin.readlines():
    l, r = map(int, line.split())
    ans = 0
    l -= 1
    r -= 1
    i, j = c_map[l]
    while l != r:
        i2, j2 = c_map[l + d]
        ans += abs(i - i2) + abs(j - j2)
        l += d
        i, j = i2, j2
    buf.append(ans)

print('\n'.join(map(str, buf)))


### FIXED CODE ###

import sys

h, w, d = map(int, input().split())
f = [list(map(int, input().split())) for _ in range(h)]

c_map = [0] * (h * w)
for i in range(h):
    for j in range(w):
        c_map[f[i][j] - 1] = (i, j)

d_map = [0] * (h * w)
for l in range(h * w - d - 1, -1, -1):
    i, j = c_map[l]
    i2, j2 = c_map[l + d]
    d_map[l] = d_map[l + d] + abs(i - i2) + abs(j - j2)

buf = []
q = int(input())
for line in sys.stdin.readlines():
    l, r = map(int, line.split())
    buf.append(d_map[l - 1] - d_map[r - 1])

print('\n'.join(map(str, buf)))
### BUGGY CODE ###

from sys import stdin
import sys
from itertools import groupby
sys.setrecursionlimit(10**6) 
n,q = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n-1)]
lin = [list(map(int,stdin.readline().rstrip().split())) for _ in range(q)]

kazu = [[]for _ in range(n)]
point = [0]*n

for i in range(n-1):
    kazu[li[i][0]-1].append(li[i][1]-1)
    kazu[li[i][1]-1].append(li[i][0]-1)
for i in range(q):
    point[lin[i][0]-1] += lin[i][1]

def dfs(now,before):
    for i in (kazu[now]):
        if i == before:
            continue
        point[i] += point[now]
        dfs(i,now)
dfs(0,-1)
print(*point)


### FIXED CODE ###

from sys import stdin
import sys
from itertools import groupby
sys.setrecursionlimit(10**6) 
n,q = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n-1)]
lin = [list(map(int,stdin.readline().rstrip().split())) for _ in range(q)]

kazu = [[]for _ in range(n)]
point = [0]*n

for i in range(len(li)):
    kazu[li[i][0]-1].append(li[i][1]-1)
    kazu[li[i][1]-1].append(li[i][0]-1)
for i in range(q):
    point[lin[i][0]-1] += lin[i][1]

def dfs(li,li2,now,before):
    for i in (li[now]):
        if i == before:
            continue
        li2[i] += li2[now]
        dfs(kazu,point,i,now)
dfs(kazu,point,0,-1)
print(*point)
### BUGGY CODE ###

from functools import reduce
import functools
import fractions
 
def gcd(*numbers):
  return reduce(gcd_, numbers)
  # return reduce(fractions.gcd, numbers)

@functools.lru_cache(maxsize=128)
def gcd_(a, b):
  if (b == 0):
    return a
  return gcd(b, a % b)
 
sum = 0
K = int(input())
 
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      sum += gcd(i,j,k)
      
print(sum)


### FIXED CODE ###

from functools import reduce
import functools
import fractions
 
@functools.lru_cache(maxsize=None)
def gcd(*numbers):
  return reduce(gcd_, numbers)

@functools.lru_cache(maxsize=None)
def gcd_(a, b):
  if (b == 0):
    return a
  return gcd(b, a % b)
 
sum = 0
K = int(input())
 
for i in range(1,K+1):
  for j in range(i,K+1):
    for k in range(j,K+1):
      if (i == j) & (j == k):
        sum += gcd(i,j,k)
      elif (i == j) & (j != k):
        sum += gcd(i,j,k)*3
      elif (i != j) & (j == k):
        sum += gcd(i,j,k)*3
      elif (i != j) & (j != k):
        sum += gcd(i,j,k)*6

print(sum)
### BUGGY CODE ###

# A, B = tuple(map(int, input().split()))
N = int(input())
list_A = list(map(int, input().split()))
result = 1
for a in list_A:
    result = result * a
threshold = 10 ** 18

if result > threshold:
    print(-1)
else:
    print(result)


### FIXED CODE ###

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

if 0 in list_A:
    print(0)
    exit()

result = 1
for a in list_A:
    result *= a
    if result > 1e18:
        print(-1)
        exit()

print(result)
### BUGGY CODE ###

import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

import numpy as np

N, K = map(int, readline().split())
H = np.array(readline().split(), dtype=np.int64)

# dp = [INF] * N
dp = np.ones(N, dtype=np.int64)*float("inf")
dp[0] = 0

# 配るDP
for i in range(N):
    for j in range(1, K+1):
        if i+j < N:
            dp[i+j] = min(dp[i+j], dp[i]+abs(H[i] - H[i+j]))
    
ans = int(dp[-1])
print(ans)

### FIXED CODE ###

import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, K = map(int, readline().split())
H = list(map(int, readline().split()))

dp = [INF] * N
dp[0] = 0

# 配るDP
for i in range(N):
    for j in range(1, K+1):
        if i+j < N:
            dp[i+j] = min(dp[i+j], dp[i]+abs(H[i] - H[i+j]))
    
ans = dp[-1]
print(ans)
### BUGGY CODE ###


from collections import deque

H, W = map(int, input().split())
C_h, C_w = map(int, input().split())
D_h, D_w = map(int, input().split())
X = [input() for _ in range(H)]

inf = 10 ** 9
visited = [[inf] * W for _ in range(H)]
visited[C_h - 1][C_w - 1] = 0
q = deque()
q.append((C_h - 1, C_w - 1))

while q:
    u, v = q.popleft()
    for i, j in [(0, 1), (0, -1), (1, 0), (-1, 0)]:
        if (0 <= u + i < H and 0 <= v + j < W and X[u + i][v + j] == "."
                and visited[u + i][v + j] > visited[u][v]):
            visited[u + i][v + j] = visited[u][v]
            q.append((u + i, v + j))

    for i in range(-2, 3):
        for j in range(-2, 3):
            if (0 <= u + i < H and 0 <= v + j < W and X[u + i][v + j] == "."
                    and visited[u + i][v + j] > visited[u][v] + 1):
                visited[u + i][v + j] = visited[u][v] + 1
                q.append((u + i, v + j))

if visited[D_h - 1][D_w - 1] < inf:
    print(visited[D_h - 1][D_w - 1])
else:
    print(-1)


### FIXED CODE ###


from collections import deque

H, W = map(int, input().split())
C_h, C_w = map(int, input().split())
D_h, D_w = map(int, input().split())
X = [input() for _ in range(H)]

inf = 10 ** 9
dist = [[inf] * W for _ in range(H)]
dist[C_h - 1][C_w - 1] = 0
q1 = deque()
q1.append((C_h - 1, C_w - 1))
q2 = deque()


def bfs_1():
    while q1:
        u, v = q1.popleft()
        q2.append((u, v))
        for i, j in [(0, 1), (0, -1), (1, 0), (-1, 0)]:
            if (0 <= u + i < H and 0 <= v + j < W
                    and X[u + i][v + j] == "."
                    and dist[u + i][v + j] > dist[u][v]):
                dist[u + i][v + j] = dist[u][v]
                q1.append((u + i, v + j))
                q2.append((u + i, v + j))


def bfs_2():
    while q2:
        u, v = q2.popleft()
        for i in range(-2, 3):
            for j in range(-2, 3):
                if (0 <= u + i < H and 0 <= v + j < W
                        and X[u + i][v + j] == "."
                        and dist[u + i][v + j] > dist[u][v] + 1):
                    dist[u + i][v + j] = dist[u][v] + 1
                    q1.append((u + i, v + j))


while q1 or q2:
    bfs_1()
    bfs_2()

if dist[D_h - 1][D_w - 1] < inf:
    print(dist[D_h - 1][D_w - 1])
else:
    print(-1)
### BUGGY CODE ###

import numpy as np

n = int(input())
a_list = input().split()
a_list = [int(a) for a in a_list]

b_list = input().split()
b_list = [int(b) for b in b_list]

c_list = input().split()
c_list = [int(c) for c in c_list]
# a_ar = np.unique(np.array(a_list))
# b_ar = np.unique(np.array(b_list))
# c_ar = np.unique(np.array(c_list))
a_ar = np.array(a_list)
b_ar = np.array(b_list)
c_ar = np.array(c_list)
count = 0
for a in a_ar:
    for b in b_ar[b_ar>a]:
        count += len(c_ar[c_ar>b])

print(count)

### FIXED CODE ###

import bisect

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

a = sorted(a)
b = sorted(b)
c = sorted(c)

ans = 0

for x in b:
    aa = bisect.bisect_left(a,x)
    cc = len(c) - bisect.bisect_right(c,x)
    ans += aa * cc

print(ans)
### BUGGY CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N = I()
A = III()

import fractions
from functools import reduce
def lcm_base(x,y):
    return (x*y) // fractions.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)

x = lcm_list(A)
y = [x//a for a in A]

ans = 0
for i in range(N):
    ans += y[i]
    ans %= mod

print(ans)

### FIXED CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N = I()
A = III()

#互いに素なa,bについて、a*x+b*y=1の一つの解[x,y]を出力
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]


#aの逆元(mod M)を求める（aとMは互いに素）
def mod_inv(a,M=mod):
    if a==0:
        return 0
    x = extgcd(a,M)[0]
    return (M+x%M)%M

inv_list = [mod_inv(a) for a in range(max(A)+1)]

import fractions
from functools import reduce
def lcm_base(x,y):
    return (x*y) // fractions.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)

x = lcm_list(A) % mod
y = [x*inv_list[a] for a in A]

ans = 0
for i in range(N):
    ans += y[i]
    ans %= mod

print(ans)
### BUGGY CODE ###

#

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    mod = 10**9 + 7

    N,K = map(int, input().split())
    a = tuple(map(int, input().split()))
    dp = [[0]*(K+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        temp = dp[i][0]
        k = a[i]
        for j in range(K+1):
            if j == 0:
                dp[i+1][j] = temp
                continue
            if j <= k:
                temp += dp[i][j]
                dp[i+1][j] = temp
            else:
                temp += dp[i][j] - dp[i][j-k-1]
                dp[i+1][j] = temp
    print(dp[N][K]%mod)


if __name__ == '__main__':
    main()

### FIXED CODE ###

#

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    mod = 10**9 + 7

    N,K = map(int, input().split())
    a = tuple(map(int, input().split()))
    dp = [[0]*(K+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        temp = dp[i][0]
        k = a[i]
        for j in range(K+1):
            if j == 0:
                dp[i+1][j] = temp
                continue
            if j <= k:
                temp += dp[i][j]
                dp[i+1][j] = temp%mod
            else:
                temp += dp[i][j] - dp[i][j-k-1]
                dp[i+1][j] = temp%mod
    print(dp[N][K]%mod)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

high, width, y, x = map(int, input().split())

def nCr(n, r):
    return ((((fact[n]*finv[n-r])%mod)*finv[r])%mod)

def powmod(a, n, m):
    if n == 0:
        return 1
    elif n == 1:
        return (a % m)
    elif n%2 == 0:
        s = powmod(a, int(n/2), m)
        temp = (s * s) % m
        return temp
    else:
        s = powmod(a, int(n/2), m)
        temp = (((s * s) % m) * a) % m
        return temp

mod = 10**9 + 7
inv = mod - 2
maxn = high + width - 2
fact = [0] * (maxn+1)
finv = [0] * (maxn+1)
fact[0] = fact[1] = 1
finv[0] = finv[1] = 1

# 階乗を求める
for i in range(2, maxn+1):
    fact[i] = (fact[i-1] * i) % mod

# 階乗の逆元を求める
for i in range(2, maxn+1):
    finv[i] = powmod(fact[i], inv, mod)

route = 0
for i in range(1, high-y+1):
        route += (nCr(x+i-2, i-1) * nCr(width+high-x-1-i, high-i)) % mod
        route = route % mod
print(int(route))

### FIXED CODE ###

high, width, y, x = map(int, input().split())

def nCr(n, r):
    return ((((fact[n]*finv[n-r])%mod)*finv[r])%mod)

mod = 10**9 + 7
inv = mod - 2
maxn = high + width - 2
fact = [0] * (maxn+1)
finv = [0] * (maxn+1)
fact[0] = fact[1] = 1
finv[0] = finv[1] = 1

# 階乗を求める
for i in range(2, maxn+1):
    fact[i] = (fact[i-1] * i) % mod

# 階乗の逆元を求める
for i in range(2, maxn+1):
    finv[i] = pow(fact[i], inv, mod)

route = 0
for i in range(1, high-y+1):
        route += (nCr(x+i-2, i-1) * nCr(width+high-x-1-i, high-i)) % mod
        route = route % mod
print(int(route))
### BUGGY CODE ###

n = int(input())
a = input().split()
b = 0
for i in range(n):
    if i == 0:
        b = int(a[i])
    else:
        b = b * int(a[i])
if b > 10 ** 18:
    print(-1)
else:
    print(int(b))

### FIXED CODE ###

n = int(input())
a = input().split()
b = 0
is_include_zero = False
too_big = False
for i in a:
    if int(i) > 10 ** 18:
        print(-1)
        too_big = True
    if int(i) == 0:
        is_include_zero = True
if too_big:
    pass
elif is_include_zero:
    print(0)
else:
    for i in range(n):
        if b > 10 ** 18:
            break
        if i == 0:
            b = int(a[i])
        else:
            b = b * int(a[i])
    if b > 10 ** 18:
        print(-1)
    else:
        print(int(b))
### BUGGY CODE ###

n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [10**10]*n
dp[0] = 0
for i in range(n):
    for j in range(k+1):
        if i - j >= 0:
            dp[i] = min(dp[i],dp[i-j] + abs(h[i] - h[i-j]))
print(dp[n-1])

### FIXED CODE ###

n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [10**10]*n
dp[0] = 0
for i in range(n):
    for j in range(k+1):
        if i - j >= 0:
            dp[i] = min(dp[i],dp[i-j] + abs(h[i] - h[i-j]))
print(dp[n-1])
### BUGGY CODE ###

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

for i in range(n):
    a_copy = a[:]
    del a_copy[i]
    c = collections.Counter(a_copy)
    cnt = 0
    for i in c.values():
        cnt += i * (i-1) // 2

    
    print(cnt)

### FIXED CODE ###

import collections
n = int(input())
a = list(map(int,input().split()))
cnt = 0
c = collections.Counter(a)
for i in c.values():
    cnt += i*(i-1) // 2
for j in range(n):
    print(cnt - c[a[j]] + 1)
### BUGGY CODE ###

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

from fractions import Fraction

mod = int(1e9+7)
n = ii()
cnd = {}
azero = 0
bzero = 0
allzero = 0
for _ in range(n):
    a,b = iim()
    if a*b == 0:
        if a == 0 and b != 0:
            azero += 1
        elif a != 0 and b == 0:
            bzero += 1
        else:
            allzero += 1
    else:
        ratio = Fraction(a,b)
        before = cnd.get(ratio,False)
        check = cnd.get(-1*Fraction(1,ratio),False)
        if before:
            cnd[ratio] = [before[0]+1,before[1]]
        elif check:
            cnd[-1*Fraction(1,ratio)] = [check[0],check[1]+1]
        else:
            cnd[ratio] = [1,0]

cnd[0] = [azero,bzero]
noreg = 0
ans = 1
#print(cnd)
for item in cnd.values():
    if item[0] == 0  or item[1] == 0:
        noreg += max(item[0],item[1])
    else:
        ans *= (2**item[0]%mod+2**item[1]%mod-1)%mod
        ans %= mod
#print('hoge')
print(int((ans*((2**noreg)%mod)-1+allzero)%mod))

### FIXED CODE ###

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

#from fractions import Fraction
from math import gcd

mod = int(1e9+7)
n = ii()
cnd = {}
azero = 0
bzero = 0
allzero = 0
for _ in range(n):
    a,b = iim()
    if a == 0:
        if b != 0:
            azero += 1
        else:
            allzero += 1
    elif b == 0:
        bzero += 1            
    else:
        '''
        ratio = Fraction(a,b)
        before = cnd.get(ratio,False)
        if before:
            cnd[ratio] = [before[0]+1,before[1]]
        else:
            invratio = Fraction(-b,a)
            check = cnd.get(invratio,False)
            if check:
                cnd[invratio] = [check[0],check[1]+1]
            else:
                cnd[ratio] = [1,0]
        '''
        g = gcd(a,b)
        a //= g
        b //= g
        if a < 0:
            a *= -1
            b *= -1
        cnd[(a,b)] = cnd.get((a,b),0)+1


noreg = 0
if azero == 0 or bzero == 0:
    noreg += max(azero,bzero)
    ans = 1
else:
    ans = (2**azero%mod + 2**bzero%mod - 1)%mod
#print('ans block')
#print(ans,noreg)
#print(cnd)
for k,item in cnd.items():
    a,b = k
    if b>0:
        m = cnd.get((b,-a),False)
        if m:
            ans *= (2**item%mod+2**m%mod-1)%mod
        else:
            noreg += item
    else:
        m = cnd.get((-b,a),False)
        if not m:
            noreg += item
#print('hoge')
print(int((ans*((2**noreg)%mod)-1+allzero)%mod))
### BUGGY CODE ###

def exteuc(a, b):
    # ax + by = gcd(a, b)
    if b == 0:
        return 1, 0, a
    y, x, v = exteuc(b, a % b)
    y -= (a//b) * x
    return x, y, v


def modinv(a, mod):
    x, _, _ = exteuc(a, mod)
    return x % mod


def comb(n, k, mod):
    if k > n//2:
        return comb(n, n - k, mod)
    ret = 1
    for i in range(k):
        ret *= n - i
        ret *= modinv(k - i, mod)
        ret %= mod
    return ret


def main():
    MOD = 10**9 + 7
    N = int(input())
    A = list(map(int, input().split(' ')))
    # calculate duplicate indices
    # Ex. [1, 4, 2, 1, 3] -> 0, 3
    dup_first_index, dup_second_index = -1, -1
    indices = [-1 for _ in range(N)]
    for i, a in enumerate(A):
        if indices[a - 1] != -1:
            dup_first_index, dup_second_index = indices[a - 1], i
            break
        indices[a - 1] = i
    # calculate answer
    ans = [0 for _ in range(N + 1)]
    for i in range(N + 1):
        ans[i] = comb(N + 1, i + 1, MOD)
        # Ex. [1, 4, 2, 5, 4, 3, 6] -> [1] + [3, 6] -> 3
        s = dup_first_index + N - dup_second_index
        if s >= i:
            ans[i] -= comb(s, i, MOD)
    for a in ans:
        print(a)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def exteuc(a, b):
    # ax + by = gcd(a, b)
    if b == 0:
        return 1, 0, a
    y, x, v = exteuc(b, a % b)
    y -= (a//b) * x
    return x, y, v


def modinv(a, mod):
    x, _, _ = exteuc(a, mod)
    return x % mod


def main():
    MOD = 10**9 + 7
    N = int(input())
    A = list(map(int, input().split(' ')))
    # calculate duplicate indices
    # Ex. [1, 4, 2, 1, 3] -> 0, 3
    dup_first_index, dup_second_index = -1, -1
    indices = [-1 for _ in range(N)]
    for i, a in enumerate(A):
        if indices[a - 1] != -1:
            dup_first_index, dup_second_index = indices[a - 1], i
            break
        indices[a - 1] = i
    # Ex. [1, 4, 2, 5, 4, 3, 6] -> [1] + [3, 6] -> 3
    s = dup_first_index + N - dup_second_index
    # calculate answer
    ans = [0 for _ in range(N + 1)]
    comb_n1, comb_s = N + 1, 1  # comb(N + 1, 1), comb(s, 0)
    for i in range(N + 1):
        ans[i] = comb_n1  # comb(N + 1, i + 1)
        comb_n1 *= (N + 1) - (i + 1)
        comb_n1 *= modinv(i + 2, MOD)
        comb_n1 %= MOD
        if s >= i:
            ans[i] -= comb_s  # comb(s, i)
            comb_s *= s - i
            comb_s *= modinv(i + 1, MOD)
            comb_s %= MOD
        ans[i] %= MOD
    for a in ans:
        print(a)


if __name__ == '__main__':
    main()