Buggy python submission (verdict: Time Limit Exceeded):
from numba import njit, i8, void
import numpy as np

mod = 10**9+7
k = int(input())
n = len(input())


@njit(i8(i8, i8, i8), cache=True)
def pow(n, k, mod):
    l, now = [1]*64, 1
    l[0] = n
    for i in range(1, 64):
        l[i] = l[i-1]*l[i-1] % mod
    for i in range(64):
        if k & 1:
            now = now*l[i] % mod
        k >>= 1
    return now


@njit(void(i8, i8, i8), cache=True)
def num_calc(n, k, mod):
    fact = np.ones(n+k+1, dtype=np.int64)
    for i in range(2, n+k+1):
        fact[i] = fact[i-1]*i % mod

    power = np.ones(k+1, dtype=np.int64)
    power[0] = fact[n+k]
    for i in range(1, k+1):
        power[i] = power[i-1]*25 % mod

    fact = fact[n+k:n-1:-1]*fact[:k+1] % mod
    ans = 0
    for i in range(k+1):
        ans = (ans+pow(fact[i], mod-2, mod)*power[i]) % mod
    print(ans)


num_calc(n, k, mod)


Fixed submission:
def main():
    mod = 10**9+7
    k = int(input())
    s = input()
    n = len(s)
    fact = [1, 1]
    for i in range(2, 2*(10**6)+1):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

    ans = 0
    for i in range(k+1):
        ans = (ans+nCr(n+k, i)*pow(25, i, mod)) % mod
    print(ans)


main()

Buggy python submission (verdict: Runtime Error):
def main():
    mod = 10**9+7
    k = int(input())
    n = len(input())

    @njit(i8[:](i8, i8), cache=True)
    def num_calc(n, mod):
        fact = np.ones(n+1, dtype=np.int64)
        for i in range(2, n+1):
            fact[i] = fact[i-1]*i % mod
        return fact

    @njit(i8[:](i8, i8), cache=True)
    def num_calc2(k, mod):
        power = np.ones(k+1, dtype=np.int64)
        for i in range(1, k+1):
            power[i] = power[i-1]*25 % mod
        return power

    @njit(i8(i8, i8, i8), cache=True)
    def pow(n, k, mod=10**9+7):
        l, now = np.ones(64, np.int64), 1
        l[0] = n
        for i in range(1, 64):
            l[i] = l[i-1]*l[i-1] % mod
        for i in range(64):
            if k & 1:
                now = now*l[i] % mod
            k >>= 1
        return now

    fact = num_calc(n+k, mod)
    nk = fact[n+k]
    fact = fact[n+k:n-1:-1]*fact[:k+1] % mod
    power = (num_calc2(k, mod)*nk) % mod

    print(sum([pow(i, mod-2, mod)*j for i, j in zip(fact, power)]) % mod)


main()


Fixed submission:
def main():
    mod = 10**9+7
    k = int(input())
    s = input()
    n = len(s)
    fact = [1, 1]
    for i in range(2, 2*(10**6)+1):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

    ans = 0
    for i in range(k+1):
        ans = (ans+nCr(n+k, i)*pow(25, i, mod)) % mod
    print(ans)


main()

Buggy python submission (verdict: Time Limit Exceeded):
from numba import njit, i8
import numpy as np

def main():
    mod = 10**9+7
    k = int(input())
    n = len(input())

    @njit(i8[:](i8, i8), cache=True)
    def num_calc(n, mod):
        fact = np.ones(n+1, dtype=np.int64)
        for i in range(2, n+1):
            fact[i] = fact[i-1]*i % mod
        return fact

    @njit(i8[:](i8, i8), cache=True)
    def num_calc2(k, mod):
        power = np.ones(k+1, dtype=np.int64)
        for i in range(1, k+1):
            power[i] = power[i-1]*25 % mod
        return power

    fact = num_calc(n+k, mod).tolist()
    power = num_calc2(k, mod).tolist()
    nk = fact[n+k]

    print(sum([pow(fact[n+k-i]*fact[i] % mod, mod-2, mod)
               * nk*power[i] % mod for i in range(k+1)]) % mod)


main()


Fixed submission:
def main():
    mod = 10**9+7
    k = int(input())
    s = input()
    n = len(s)
    fact = [1, 1]
    for i in range(2, 2*(10**6)+1):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

    ans = 0
    for i in range(k+1):
        ans = (ans+nCr(n+k, i)*pow(25, i, mod)) % mod
    print(ans)


main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    mod = 10**9+7
    k = int(input())
    n = len(input())
    fact = [1, 1]
    for i in range(2, n+k+1):
        fact.append(fact[-1]*i % mod)
    nk = fact[n+k]
    print(sum([pow(fact[n+k-i]*fact[i] % mod, mod-2, mod)
               * nk*pow(25, i, mod) % mod for i in range(k+1)]) % mod)


main()


Fixed submission:
def main():
    mod = 10**9+7
    k = int(input())
    s = input()
    n = len(s)
    fact = [1, 1]
    for i in range(2, 2*(10**6)+1):
        fact.append(fact[-1]*i % mod)

    def nCr(n, r, mod=10**9+7):
        return pow(fact[n-r]*fact[r] % mod, mod-2, mod)*fact[n] % mod

    ans = 0
    for i in range(k+1):
        ans = (ans+nCr(n+k, i)*pow(25, i, mod)) % mod
    print(ans)


main()