Buggy python submission (verdict: Time Limit Exceeded):
import collections
mod = 10**9+7
fac = [1]
caf = [1]
n=int(input())

def pow(n,p):
    res=1
    while p >0:
        if p%2==0:
            n = n**2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

for i in range(1,n+2):
    fac.append((fac[i-1]*i)%mod)
    caf.append(pow(fac[i],mod-2)%mod)

def ncr(n,r):
    if n < r: return 0
    return fac[n]*caf[r]*caf[n-r]

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((ncr(n+1,i)-ncr(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()


Fixed submission:
import collections
mod = 10**9+7
fac = [1]
caf = [1]
n=int(input())

def pow(n,p):
    res=1
    while p >0:
        if p%2==0:
            n = n**2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

for i in range(1,n+2):
    fac.append((fac[i-1]*i)%mod)
    caf.append(pow(fac[i],mod-2)%mod)

def ncr(n,r):
    if n < r: return 0
    return fac[n]*caf[r]*caf[n-r]

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((ncr(n+1,i)-ncr(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import collections
mod = 10**9+7
n=int(input())
kaijou = []
kaijou.append(1)
for i in range(1,n+3):
    kaijou.append(kaijou[i-1]*i)

lcom = [[0 for _ in range(n+3)] for _ in range(n+3)]

def cmb(n, r):
    if n<r:return 0
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((cmb(n+1,i)-cmb(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()

Fixed submission:
import collections
mod = 10**9+7
fac = [1]
caf = [1]
n=int(input())

def pow(n,p):
    res=1
    while p >0:
        if p%2==0:
            n = n**2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

for i in range(1,n+2):
    fac.append((fac[i-1]*i)%mod)
    caf.append(pow(fac[i],mod-2)%mod)

def ncr(n,r):
    if n < r: return 0
    return fac[n]*caf[r]*caf[n-r]

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((ncr(n+1,i)-ncr(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import collections
mod = 10**9+7
n=int(input())
kaijou = []
kaijou.append(1)
for i in range(1,n+3):
    kaijou.append(kaijou[i-1]*i)

lcom = [[0 for _ in range(n+3)] for _ in range(n+3)]

def cmb(n, r):
    if n<r:return 0
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((cmb(n+1,i)-cmb(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()

Fixed submission:
import collections
mod = 10**9+7
fac = [1]
caf = [1]
n=int(input())

def pow(n,p):
    res=1
    while p >0:
        if p%2==0:
            n = n**2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

for i in range(1,n+2):
    fac.append((fac[i-1]*i)%mod)
    caf.append(pow(fac[i],mod-2)%mod)

def ncr(n,r):
    if n < r: return 0
    return fac[n]*caf[r]*caf[n-r]

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((ncr(n+1,i)-ncr(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import collections
mod = 10**9+7
n=int(input())
kaijou = []
kaijou.append(1)
for i in range(1,n+3):
    kaijou.append(kaijou[i-1]*i)

lcom = [[0 for _ in range(n+3)] for _ in range(n+3)]

def conb(p,r):
    if lcom[p][r] == 0:
        lcom[p][r] = kaijou[p]//(kaijou[r]*kaijou[p-r])
    return lcom[p][r]

def tyoufuku(i,a,b):
    global n
    ret = 0
    if i == 1:
        return 1
    else:
        for j in range(i):
            if a < j or n-b <i-j-1:
                continue
            else:
                ret += conb(a,j)*conb(n-b,i-j-1)
        return ret


def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]

    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((conb(n+1,i)-tyoufuku(i,kaburi[0],kaburi[1]))%mod)

main()

Fixed submission:
import collections
mod = 10**9+7
fac = [1]
caf = [1]
n=int(input())

def pow(n,p):
    res=1
    while p >0:
        if p%2==0:
            n = n**2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

for i in range(1,n+2):
    fac.append((fac[i-1]*i)%mod)
    caf.append(pow(fac[i],mod-2)%mod)

def ncr(n,r):
    if n < r: return 0
    return fac[n]*caf[r]*caf[n-r]

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((ncr(n+1,i)-ncr(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import collections
mod = 10**9+7
n=int(input())
kaijou = []
kaijou.append(1)
for i in range(1,n+3):
    kaijou.append(kaijou[i-1]*i)


def conb(p,r):
    return kaijou[p]//(kaijou[r]*kaijou[p-r])

def tyoufuku(i,a,b):
    global n
    ret = 0
    if i == 1:
        return 1
    else:
        for j in range(i):
            if a < j or n-b <i-j-1:
                continue
            else:
                ret += conb(a,j)*conb(n-b,i-j-1)
        return ret


def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]

    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((conb(n+1,i)-tyoufuku(i,kaburi[0],kaburi[1]))%mod)

main()

Fixed submission:
import collections
mod = 10**9+7
fac = [1]
caf = [1]
n=int(input())

def pow(n,p):
    res=1
    while p >0:
        if p%2==0:
            n = n**2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

for i in range(1,n+2):
    fac.append((fac[i-1]*i)%mod)
    caf.append(pow(fac[i],mod-2)%mod)

def ncr(n,r):
    if n < r: return 0
    return fac[n]*caf[r]*caf[n-r]

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((ncr(n+1,i)-ncr(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import collections
mod = 10**9+7
n=int(input())
kaijou = []
kaijou.append(1)
for i in range(1,n+3):
    kaijou.append(kaijou[i-1]*i)


def conb(p,r):
    return kaijou[p]//(kaijou[r]*kaijou[p-r])

def tyoufuku(i,a,b):
    global n
    ret = 0
    if i == 1:
        return 1
    else:
        for j in range(i):
            if a < j or n-b <i-j-1:
                continue
            else:
                ret += conb(a,j)*conb(n-b,i-j-1)
        return ret


def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]

    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((conb(n+1,i)-tyoufuku(i,kaburi[0],kaburi[1]))%mod)

main()

Fixed submission:
import collections
mod = 10**9+7
fac = [1]
caf = [1]
n=int(input())

def pow(n,p):
    res=1
    while p >0:
        if p%2==0:
            n = n**2 % mod
            p //= 2
        else:
            res = res * n % mod
            p -= 1
    return res % mod

for i in range(1,n+2):
    fac.append((fac[i-1]*i)%mod)
    caf.append(pow(fac[i],mod-2)%mod)

def ncr(n,r):
    if n < r: return 0
    return fac[n]*caf[r]*caf[n-r]

def main():
    global n
    a=list(map(int,input().split()))

    ca= collections.Counter(a)
    tyo= ca.most_common()[0][0]
    kaburi=[i for i, x in enumerate(a) if x == tyo]

    for i in range(1,n+2):
        print((ncr(n+1,i)-ncr(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()