Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    p = int(input())
    *A, = map(int, input().split())

    L = p-1
    fact = [1]*(L+1)
    rfact = [1]*(L+1)
    r = 1
    for i in range(1, L+1):
        fact[i] = r = r * i % p
    rfact[L] = r = pow(r, p-2, p)
    for i in range(L, 0, -1):
        rfact[i-1] = r = r * i % p
    V = [(-fact[p-1] * rfact[k] * rfact[p-1-k]) % p for k in range(p)]

    R = [0]*p
    for i, a in enumerate(A):
        if a == 0:
            continue

        b = (-i) % p
        w = 1
        for k in range(p):
            R[k] += V[k] * w % p
            w = w * b % p
        R[-1] += 1
    for i in range(p):
        R[i] %= p
    R.reverse()
    print(*R)
solve()

Fixed submission:
def solve():
    p = int(input())
    *A, = map(int, input().split())
    B = [0]*p

    C = [0]*p
    C[0] = 1
    zeros = [0]*p

    Y = [0]*p
    R = [0]*p
    for i in range(p):
        v = 0
        b = 1
        for j in range(i):
            v += Y[j] * b
            b = b * (i-j) % p
        Y[i] = y = (A[i]-v) * pow(b, p-2, p) % p

        for j in range(i+1):
            R[j] += y * C[j]

        if i < p-1:
            C[1:] = ((b - a*i) % p for a, b in zip(C[1:], C))
            C[0] = 0
    for i in range(p):
        R[i] %= p
    print(*R)
solve()

Buggy python submission (verdict: Time Limit Exceeded):
p = int(input())
*A, = map(int, input().split())
B = [0]*p

C = [0]*(p+1)
C[0] = 1
D = [0]*(p+1)
zeros = [0]*(p+1)

Y = [0]*(p+1)

R = [0]*p
for i in range(p):
    v = 0
    b = 1
    for j in range(i):
        v += Y[j] * b % p
        b = b * (i-j) % p
    Y[i] = y = (A[i]-v) * pow(b, p-2, p) % p

    for j in range(i+1):
        R[j] += y * C[j] % p

    D[:] = zeros
    for j in range(p):
        D[j] -= C[j]*i
    for j in range(p):
        D[j+1] += C[j]
    C, D = D, C
for i in range(p):
    R[i] %= p
print(*R)

Fixed submission:
def solve():
    p = int(input())
    *A, = map(int, input().split())
    B = [0]*p

    C = [0]*p
    C[0] = 1
    zeros = [0]*p

    Y = [0]*p
    R = [0]*p
    for i in range(p):
        v = 0
        b = 1
        for j in range(i):
            v += Y[j] * b
            b = b * (i-j) % p
        Y[i] = y = (A[i]-v) * pow(b, p-2, p) % p

        for j in range(i+1):
            R[j] += y * C[j]

        if i < p-1:
            C[1:] = ((b - a*i) % p for a, b in zip(C[1:], C))
            C[0] = 0
    for i in range(p):
        R[i] %= p
    print(*R)
solve()

Buggy python submission (verdict: Time Limit Exceeded):
p = int(input())
*A, = map(int, input().split())
B = [0]*p

C = [0]*(p+1)
C[0] = 1
D = [0]*(p+1)
zeros = [0]*(p+1)

Y = [0]*(p+1)

R = [0]*p
for i in range(p):
    v = 0
    b = 1
    for j in range(i):
        v += Y[j] * b % p
        b = b * (i-j) % p
    Y[i] = y = (A[i]-v) * pow(b, p-2, p) % p

    for j in range(i+1):
        R[j] += y * C[j] % p

    D[:] = zeros
    for j in range(p):
        D[j] -= C[j]*i
    for j in range(p):
        D[j+1] += C[j]
    C, D = D, C
for i in range(p):
    R[i] %= p
print(*R)

Fixed submission:
def solve():
    p = int(input())
    *A, = map(int, input().split())
    B = [0]*p

    C = [0]*p
    C[0] = 1
    zeros = [0]*p

    Y = [0]*p
    R = [0]*p
    for i in range(p):
        v = 0
        b = 1
        for j in range(i):
            v += Y[j] * b
            b = b * (i-j) % p
        Y[i] = y = (A[i]-v) * pow(b, p-2, p) % p

        for j in range(i+1):
            R[j] += y * C[j]

        if i < p-1:
            C[1:] = ((b - a*i) % p for a, b in zip(C[1:], C))
            C[0] = 0
    for i in range(p):
        R[i] %= p
    print(*R)
solve()