Buggy python submission (verdict: Runtime Error):
#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 submission:
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))

Buggy python submission (verdict: Runtime Error):
#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])))
    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)])))

Fixed submission:
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))