Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03393 (python)

Fixed submission:
s = input()
l = list('abcdefghijklmnopqrstuvwxyz')
for s_ in s:
    l.remove(s_)
if l==[]:
    l.append(s[-1])
    for i in range(len(s)-2,-1,-1):
        if s[i]<max(l):
            for k in l:
                if k>s[i]:
                    print(s[:i]+k)
                    exit()
        l.append(s[i])
    print(-1)
else:
    print(s+l[0])

Buggy submission (verdict: Runtime Error):
s = input()
l = list('abcdefghijklmnopqrstuvwxyz')
for s_ in s:
    l.remove(s_)
print(s+l[0])
Problem p03413 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
f = 1
for i in range(n):
    if a[i]>0:
        f = 0
if f:
    ind = a.index(max(a))
    print(max(a))
    list = []
    for i in range(n,ind+1,-1):
        list.append(i)
    for _ in range(ind):
        list.append(1)
    print(len(list))
    for i in list:
        print(i)
    exit()
g1 = a[1::2]
g2 = a[::2]
ans1,ans2 = 0,0
l1,l2 = [],[]
for i in range(len(g1)):
    if g1[i]>0:
        ans1 += g1[i]
        l1.append(i*2+2)
for i in range(len(g2)):
    if g2[i]>0:
        ans2 += g2[i]
        l2.append(i*2+1)
length = n
if ans1>=ans2:
    print(ans1)
    list = []
    for i in range(n,l1[-1],-1):
        list.append(i)
    length -= n-l1[-1]
    for i in range(l1[-1],l1[0],-2):
        if not i in l1:
            list.append(i)
            length -= 2
    for i in range(l1[0]-1):
        list.append(1)
    length -= l1[0]
    for _ in range(length,0,-2):
        list.append(2)
    print(len(list))
    for i in list:
        print(i)
else:
    print(ans2)
    list = []
    for i in range(n,l2[-1],-1):
        list.append(i)
    length -= n-l2[-1]
    for i in range(l2[-1],l2[0],-2):
        if not i in l2:
            list.append(i)
            length -= 2
    for i in range(l2[0]-1):
        list.append(1)
    length -= l2[0]
    for _ in range(length,0,-2):
        list.append(2)
    print(len(list))
    for i in list:
        print(i)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
g1 = a[1::2]
g2 = a[::2]
ans1,ans2 = 0,0
l1,l2 = [],[]
for i in range(len(g1)):
    if g1[i]>0:
        ans1 += g1[i]
        l1.append(i*2+2)
for i in range(len(g2)):
    if g2[i]>0:
        ans2 += g2[i]
        l2.append(i*2+1)
length = n
if ans1>=ans2:
    print(ans1)
    list = []
    for i in range(n,l1[-1],-1):
        list.append(i)
    length -= n-l1[-1]
    for i in range(l1[-1],l1[0],-2):
        if not i in l1:
            list.append(i)
            length -= 2
    for i in range(l1[0]-1):
        list.append(1)
    length -= l1[0]
    for _ in range(length,0,-2):
        list.append(2)
    print(len(list))
    for i in list:
        print(i)
else:
    print(ans2)
    list = []
    for i in range(n,l2[-1],-1):
        list.append(i)
    length -= n-l2[-1]
    for i in range(l2[-1],l2[0],-2):
        if not i in l2:
            list.append(i)
            length -= 2
    for i in range(l2[0]-1):
        list.append(1)
    length -= l2[0]
    for _ in range(length,0,-2):
        list.append(2)
    print(len(list))
    for i in list:
        print(i)
Problem p03424 (python)

Fixed submission:
n = int(input())
s = list(input().split())
ans = 'Three'
for s_ in s:
    if s_=='Y':
        ans = 'Four'
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
ans = 'Three'
for s_ in s:
    if s_=='Y':
        ans = 'Four'
print(ans)
Problem p03474 (python)

Fixed submission:
a,b = map(int,input().split())
s = input()
l = [str(i) for i in range(10)]
for i in range(a):
    if not s[i] in l:
        print('No')
        exit()
for i in range(b):
    if not s[a+i+1] in l:
        print('No')
        exit()
if not s[a]=='-':
    print('No')
    exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
a,b = int(input())
s = input()
l = [str(i) for i in range(10)]
for i in range(a):
    if not s[i] in l:
        print('No')
        exit()
for i in range(b):
    if not s[a+i] in l:
        print('No')
        exit()
if not s[a]=='-':
    print('No')
    exit()
print('Yes')
Problem p03476 (python)

Fixed submission:
q = int(input())
l = [list(map(int,input().split())) for _ in range(q)]

def prime_table(n):
    list = [True for _ in range(n+1)]
    for i in range(2,int(n**0.5)+1):
        if list[i]:
            j = i*2
            while j<=n:
                list[j] = False
                j += i
    table = [i for i in range(n+1) if list[i] and i>=2]
    return table

table = prime_table(10**5)
sim_sum = [0]*(10**5+1)

for i in range(len(table)):
    if table[i]*2-1 in table:
        sim_sum[table[i]*2-1] += 1
for i in range(1,10**5+1):
    sim_sum[i] += sim_sum[i-1]
for l_ in l:
    print(sim_sum[l_[1]]-sim_sum[max(l_[0]-2,0)])

Buggy submission (verdict: Runtime Error):
q = int(input())
l = [list(map(int,input().split())) for _ in range(q)]

def prime_table(n):
    list = [True for _ in range(n+1)]
    for i in range(2,int(n**0.5)+1):
        if list[i]:
            j = i*2
            while j<=n:
                list[j] = False
                j += i
    table = [i for i in range(n+1) if list[i] and i>=2]
    return table

table = prime_table(10**5)
table = set(table)
sim_sum = [0]*(10**5+1)

for i in range(len(table)):
    if table[i]*2-1 in table:
        sim_sum[table[i]*2-1] += 1
for i in range(1,10**5+1):
    sim_sum[i] += sim_sum[i-1]
for l_ in l:
    print(sim_sum[l_[1]]-sim_sum[max(l_[0]-2,0)])
Problem p03486 (python)

Fixed submission:
s = input()
t = input()
s = list(s)
t = list(t)
s_ = sorted(s)
t_ = sorted(t)
t_.reverse()
if ''.join(s_)<''.join(t_):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
    exit()
s = list(s)
t = list(t)
s_ = sorted(s)
t_ = sorted(t)
t_.reverse()
if ''.join(s_)<''.join(t_):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
if s==t:
    print('No')
    exit()
s = list(s)
t = list(t)
s_ = sorted(s)
t_ = sorted(t)
t_.reverse()
print(s_)
print(t_)
for i in range(len(s_)):
    if s[i]<t[i]:
        print('Yes')
        exit()
    elif s[i]>t[i]:
        print('No')
        exit()
print('Yes')
Problem p03502 (python)

Fixed submission:
n = input()
f_x=0
for i in range(len(n)):
    f_x+=int(n[i])
if int(n)%f_x==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = input()
f_x=0
for i in range(len(n)):
    f_x+=int(n[i])
if int(n)%f_n==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
f_x=0
for i in range(len(n)):
    f_x+=int(n[i])
if int(n)%f_n==0:
    print('Yes')
else:
    print('No')
Problem p03504 (python)

Fixed submission:
n,c = map(int,input().split())
l = [[0]*(10**5+1) for _ in range(c+1)]
for _ in range(n):
    s,t,c = map(int,input().split())
    for i in range(s,t+1):
        l[c-1][i] = 1
ans = [0]*(10**5+1)
for i in range(len(l)):
    for j in range(len(l[i])):
        ans[j] += l[i][j]
print(max(ans))

Buggy submission (verdict: Runtime Error):
n,c = map(int,input().split())
l = [[0]*(10**5+1) for _ in range(c+1)]
for _ in range(n):
    s,t,c = map(int,input().split())
    for i in range(s,t+1):
        l[c-1][i] = 1
ans = [0]*10**5
for i in range(len(l)):
    for j in range(len(l[i])):
        ans[j] += l[i][j]
print(max(ans))

Buggy submission (verdict: Runtime Error):
n,c = map(int,input().split())
l = [[0]*10**5 for _ in range(c)]
for _ in range(n):
    s,t,c = map(int,input().split())
    for i in range(s,t+1):
        l[c-1][i] = 1
ans = [0]*10**5
for i in range(len(l)):
    for j in range(len(l[i])):
        ans[j] += l[i][j]
print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
div = make_divisors(n)
for i in div[1:]:
    if n//(i-1)==n%(i-1):
        ans += i-1

print(ans)
Problem p03545 (python)

Fixed submission:
a,b,c,d = map(int,list(input()))
for i in range(2):
    if i==0:
        ans=a+b
    else:
        ans=a-b
    r1=ans
    for j in range(2):
        ans=r1
        if j==0:
            ans+=c
        else:
            ans-=c
        r2=ans
        for k in range(2):
            ans=r2
            if k==0:
                ans+=d
            else:
                ans-=d
            if ans==7:
                ret=[i,j,k]
                for i in range(len(ret)):
                    if ret[i]==0:
                        ret[i]='+'
                    else:
                        ret[i]='-'
                print('{}{}{}{}{}{}{}=7'.format(a,ret[0],b,ret[1],c,ret[2],d))
                exit()

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,list(input()))
for i in range(2):
    if i==0:
        ans=a+b
    else:
        ans=a-b
    for j in range(2):
        if j==0:
            ans+=c
        else:
            ans-=c
        for k in range(2):
            if k==0:
                ans+=d
            else:
                ans-=d
            if ans==7:
                ret=[i,j,k]
for i in range(len(ret)):
    if ret[i]==0:
        ret[i]='+'
    else:
        ret[i]='-'
print('{}{}{}{}{}{}{}=7'.format(a,ret[0],b,ret[1],c,ret[2],d))
Problem p03546 (python)

Fixed submission:
h,w = map(int,input().split())
c = [list(map(int,input().split())) for _ in range(10)]
a = [list(map(int,input().split())) for _ in range(h)]
memo = {}
def dfs(nv,vl,cost):
    if nv==1:
        return cost
    if nv in memo.keys():
        return cost+memo[nv]
    vl_ = vl.copy()
    vl_.append(nv)
    ret = []
    for i in range(10):
        if not i in vl_:
            ret.append(dfs(i,vl_,cost+c[nv][i]))
    return min(ret)
cost = []
for i in range(10):
    memo[i] = dfs(i,[],0)
ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j]!=-1:
            ans += memo[a[i][j]]
print(ans)

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
c = [list(map(int,input().split())) for _ in range(10)]
a = [list(map(int,input().split())) for _ in range(h)]

def dfs(nv,vl,cost):
    if nv==1:
        return cost
    vl_ = vl.copy()
    vl_.append(nv)
    ret = []
    for i in range(10):
        if not i in vl_:
            ret.append(dfs(i,vl_,cost+c[nv][i]))
    return min(ret)
cost = []
for i in range(10):
    cost.append(dfs(i,[],0))
ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j]!=-1:
            ans += cost[a[i][j]]
print(ans)

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
c = [list(map(int,input().split())) for _ in range(10)]
a = [list(map(int,input().split())) for _ in range(h)]

def dfs(nv,vl,cost):
    if nv==1:
        return cost
    vl_ = vl.copy()
    vl_.append(nv)
    ret = []
    for i in range(10):
        if not i in vl_:
            ret.append(dfs(i,vl_,cost+c[nv][i]))
    return min(ret)
cost = []
for i in range(10):
    cost.append(dfs(i,[],0))
ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j]!=-1:
            ans += cost[a[i][j]]
print(ans)
Problem p03608 (python)

Fixed submission:
n,m,r = map(int,input().split())
r = list(map(int,input().split()))
node = [list(map(int,input().split())) for _ in range(m)]
dp = [[float('inf')]*(n+1) for _ in range(n+1)]
for x,y,z in node:
    dp[x][y] = z
    dp[y][x] = z
for i in range(n+1):
    dp[i][i] = 0
def wf(d,n):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if d[i][j]>d[i][k]+d[k][j]:
                    d[i][j] = d[i][k]+d[k][j]
    return d
dp = wf(dp,n+1)
import copy
import sys
rest = set(r[:])
def dfs(cost,pre,rest):
    if 0==len(rest):
        return cost
    ret = sys.maxsize
    for i in rest:
        if pre==None:
            next_cost = 0
        else:
            next_cost = cost + dp[pre][i]
        next_rest = copy.copy(rest)
        next_rest.remove(i)
        tmp_ret = dfs(next_cost, i, next_rest)
        ret = min(ret,tmp_ret)
    return ret
print(dfs(0,None,rest))

Buggy submission (verdict: Runtime Error):
n,m,r = map(int,input().split())
r = list(map(int,input().split()))
node = [list(map(int,input().split())) for _ in range(m)]
dic = {}
for i in range(1,n+1):
    dic[i] = {}
    for j in range(1,n+1):
        dic[i][j]=10**6
for a,b,c in node:
    dic[a][b] = c
    dic[b][a] = c
dp = [[10**8]*(n+1) for _ in range(n+1)]
for i in range(n+1):
    dp[0][i] = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        dp[i][j] = dic[i][j]
        for k in range(1,n+1):
            dp[i][j] = min(dp[i][j], dic[i][k]+dic[k][j])
def dfs(dv,nv,cost):
    if sum(dv)==len(dv):
        return cost
    ret = []
    for i in range(len(dv)):
        if dv[i]==1:
            continue
        dv_ = dv.copy()
        dv_[i] = 1
        ret.append(dfs(dv_,r[i],cost+dp[nv][r[i]]))
    return min(ret)
print(dfs([0]*len(r),0,0))

Buggy submission (verdict: Runtime Error):
n,m,r = map(int,input().split())
r = list(map(int,input().split()))
node = [list(map(int,input().split())) for _ in range(m)]
dic = {}
for i in range(1,n+1):
    dic[i] = {}
    for j in range(1,n+1):
        dic[i][j]=10**6
for a,b,c in node:
    dic[a][b] = c
    dic[b][a] = c
dp = [[10**8]*(n+1) for _ in range(n+1)]
for i in range(n+1):
    dp[0][i] = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        dp[i][j] = dic[i][j]
        for k in range(1,n+1):
            dp[i][j] = min(dp[i][j], dic[i][k]+dic[k][j])
def dfs(dv,nv,cost):
    if sum(dv)==len(dv):
        return cost
    ret = []
    for i in range(len(dv)):
        if dv[i]==1:
            continue
        dv_ = dv.copy()
        dv_[i] = 1
        ret.append(dfs(dv_,r[i],cost+dp[nv][r[i]]))
    return min(ret)
print(dfs([0]*len(r),0,0))
Problem p03644 (python)

Fixed submission:
n = int(input())
num=0
if n==1:
    print(1)
    exit()
else:
    for i in range(1,n+1):
        k=0
        c=i
        while True:
            if c%2==0:
                c/=2
                k+=1
            else:
                break
        if k>num:
            num=k
            ans=i
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
num=0
for i in range(1,n+1):
    k=0
    c=i
    while True:
        if c%2==0:
            c/=2
            k+=1
        else:
            break
    if k>num:
        num=k
        ans=i
print(ans)
Problem p03665 (python)

Fixed submission:
n,p=map(int,input().split())
a = list(map(int,input().split()))
k=0
for a_ in a:
    if not a_%2==0:
        k=1
        break
if k:
    print(1<<(n-1))
else:
    print(0) if p==1 else print(1<<n)

Buggy submission (verdict: Runtime Error):
n,p=map(int,input().split())
a = list(map(int,input().split()))
for a_ in a:
    if not a_%2==0:
        k=1
        break
if k:
    print(1<<(n-1))
else:
    print(0) if p==1 else print(1<<n)
Problem p03681 (python)

Fixed submission:

a,b = map(int,input().split())
import math
if a==b:
  print((math.factorial(a)%(10**9+7))**2*2%(10**9+7))
elif abs(a-b)==1:
  print((math.factorial(max(a,b))%(10**9+7))*(math.factorial(min(a,b))%(10**9+7))%(10**9+7))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().spilit())
import math
if a==b:
  print(math.factorial(a)**2*2%(10**9+7))
elif abs(a-b)==1:
  print(math.factorial(a)*math.factorial(b))
else:
  print(0)
Problem p03697 (python)

Fixed submission:
a,b = map(int,input().split())
if a+b>=10:
  print('error')
else:
  print(a+b)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a+b>=10:
  print(error)
else:
  print(a+b)
Problem p03712 (python)

Fixed submission:
a,b = map(int,input().split())
ans = []
for _ in range(a):
  c = input()
  ans.append('#{}#'.format(c))
print('#'*(b+2))
for _ in ans:
    print(_)
print('#'*(b+2))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input()split())
print('#'*(b+2))
for _ in range(a):
  c = input()
  print('#{}#'.format(c))
print('#'*(b+2))
Problem p03807 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
odd = 0
for i in range(n):
    if a[i]%2==1:
        odd+=1
if odd==0 or odd%2==0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
odd = 0
for i in range(n):
    if a[i]%2==1:
        odd+=1
if odd%2==0:
    print('YES')
else:
    pritn('NO')
Problem p03844 (python)

Fixed submission:
a,b,c = input().split()
if b=='+':
  print(int(a)+int(c))
else:
  print(int(a)-int(c))

Buggy submission (verdict: Runtime Error):
a,b,c = input().split()
if b=='+':
  print(int(a)+int(c))
else:
  print(int(a)-int(b))
Problem p02639 (python)

Fixed submission:
a=list(map(int,input().split()))
print(a.index(0)+1)

Buggy submission (verdict: Runtime Error):
N = list(map(int, input().split())) 
for i in N:
  if N[i] == 0:
    print(i+1)

Buggy submission (verdict: Runtime Error):
N = list(map(int, input().split())) 
print(N)
for i in N:
  if N[i] == 0:
    print(i+1)
Problem p02645 (python)

Fixed submission:
s = input()
print(s[0:3])

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split()) 
B, W= map(int, input().split()) 
T = int(input())


diff1 = B - A
diff2 = (V - W)*T

if ( diff1 < diff2):
  print("YES")
else:
  print("NO")
Problem p02830 (python)

Fixed submission:
s = int(input())
str1, str2 = [s for s in input().split()]


ans=[]
for i in range(s):
  ans += str1[i]
  ans += str2[i]

  
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
s = int(input())
str1, str2 = [s for s in input().split()]

ans=[]
for i in range(4):
  ans += str1[i]
  ans += str2[i]

  
print(''.join(ans))
Problem p02885 (python)

Fixed submission:
from sys import stdin
A, B = [int(x) for x in stdin.readline().rstrip().split()]
if A > 2*B:
  print(A - 2*B)
elif A <= 2*B:
  print(0)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=str(input())

a=N

for i in range(N-1):
    if S[i]==S[i+1]:
        a-=1

print(a)
Problem p02969 (python)

Fixed submission:
r = int(input())
s = 3*r**2
print(s)

Buggy submission (verdict: Runtime Error):
r = input()
s = 3*r**2
print(s)
Problem p02993 (python)

Fixed submission:
# coding: utf-8
# Your code here!

i=int(input())


lst = []
while i > 0:
    lst.append(i%10)
    i //= 10 
lst.reverse()
#print(lst)
if (len(lst) == 4):
    if (lst[0] == lst[1] or lst[1] == lst[2] or lst[2] == lst[3] ):
        print('Bad')
    else:
        print('Good')
elif (len(lst) == 3):
    if (lst[0] == lst[1] or lst[1] == lst[2]):
        print('Bad')
    else:
        print('Good')
elif (len(lst) == 2 or 1 or 0):
    print('Bad')

Buggy submission (verdict: Runtime Error):
i=int(input())


lst = []
while i > 0:
    lst.append(i%10)
    i //= 10 
lst.reverse()
if (lst[0] == lst[1] or lst[1] == lst[2] or lst[2] == lst[3] ):
    print('Bad')
else:
    print('Good')
Problem p02719 (python)

Fixed submission:
n, m = map(int, input().split())
n = n % m
if m == 1:  
    print(0)
elif n < m:
    print(min(abs(n-m), n))
else: 
    print(abs(n - m))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = input().split()
a = [int(i) for i in a]
s = sum(a)
dif = (1 / (4*m)) * s
cont = 0
for i in a:
     cont += (1 if i >= dif else 0)
print ('Yes' if cont >= m else 'No')
Problem p02730 (python)

Fixed submission:
def check(s):
    i, j = 0, len(s) - 1
    while i < j:
        if s[i] != s[j]:
            return False
        i += 1; j -= 1
    return True
s = input()
n = len(s)
n_S = s[0:(n - 1)//2]
n_E = s[(n+3)//2 - 1::]

if check(s) and check(n_S) and check(n_E):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

bool check_STR(string cad, int n)
{
    for (int i = 0, j = n - 1; i < n/2; i++, j--)
        if (cad[i] != cad[j])
            return false;
    return true;
}
int main()
{
    string cad, cad_S, cad_E; cin >> cad;
    int n = cad.size();
    cad_S = cad.substr(0, (n - 1)/ 2);
    cad_E = cad.substr((n+3)/2 - 1);
    if (check_STR(cad, n) && check_STR(cad_S, cad_S.size()) && check_STR(cad_E, cad_E.size()))
        puts("Yes");
    else
        puts("No");
 
}
Problem p02639 (python)

Fixed submission:
import sys
a = list(map(int, sys.stdin.readline().rstrip().split(' ')))
 
for i in range(len(a)):
  if a[i] == 0:
    print(i+1)
    break

Buggy submission (verdict: Runtime Error):
import sys
a = map(int, sys.stdin.readline().rstrip().split(' '))

for i in range(len(a)):
  if a[i] == 0:
    print(i+1)
    break
Problem p02632 (python)

Fixed submission:
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

MOD = 10**9 + 7

def main(K, N, MOD):
    def fact_table(N, MOD):
        inv = np.empty(N, np.int64)
        inv[0] = 0
        inv[1] = 1
        for n in range(2, N):
            q, r = divmod(MOD, n)
            inv[n] = inv[r] * (-q) % MOD
        fact = np.empty(N, np.int64)
        fact[0] = 1
        for n in range(1, N):
            fact[n] = n * fact[n - 1] % MOD
        fact_inv = np.empty(N, np.int64)
        fact_inv[0] = 1
        for n in range(1, N):
            fact_inv[n] = fact_inv[n - 1] * inv[n] % MOD
        return fact, fact_inv, inv

    fact, fact_inv, inv = fact_table(2_000_010, MOD)
    f = np.zeros(K + 1, np.int64)
    f = fact[N - 1:K + N] * fact_inv[N - 1] % MOD * fact_inv[0:K + 1] % MOD

    x = 1
    for i in range(1, K + 1):
        x = (x * 25) % MOD
        f[i] = f[i] * x % MOD
    for i in range(1, K + 1):
        f[i] += f[i - 1] * 26
        f[i] %= MOD
    return f[-1]

if sys.argv[-1] == 'ONLINE_JUDGE':  #　なにそれ
    import numba
    from numba.pycc import CC
    i8 = numba.from_dtype(np.int64)
    signature = (i8, i8, i8)

    cc = CC('my_module')
    cc.export('main', signature)(main)
    cc.compile()


from my_module import main
K = int(readline())
N = len(read().rstrip())

print(main(K, N, MOD))

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
readline = sys.stdin.buffer.readline

MOD = 10 ** 9 + 7


def main(K, N, MOD):
    def cumprod(A, mod=MOD):
        L = len(A)
        Lsq = int(L**.5 + 1)
        A = np.resize(A, Lsq**2).reshape(Lsq, Lsq)
        for n in range(1, Lsq):
            A[:, n] *= A[:, n - 1]
            A[:, n] %= mod
        for n in range(1, Lsq):
            A[n] *= A[n - 1, -1]
            A[n] %= mod
        return A.ravel()[:L]

    def make_fact(U, mod=MOD):
        x = np.arange(U, dtype=np.int64)
        x[0] = 1
        fact = cumprod(x, mod)
        x = np.arange(U, 0, -1, dtype=np.int64)
        x[0] = pow(int(fact[-1]), mod - 2, mod)
        fact_inv = cumprod(x, mod)[::-1]
        fact.flags.writeable = False
        fact_inv.flags.writeable = False
        return fact, fact_inv

    fac, finv = make_fact(2_000_010, MOD)
    f = np.zeros(K + 1, np.int64)
    f = fac[N - 1:K + N] * finv[N - 1] % MOD * finv[:K + 1] % MOD

    x = 1
    for i in range(1, K + 1):
        x = (x * 25) % MOD
        f[i] = f[i] * x % MOD
    for i in range(1, K + 1):
        f[i] += f[i - 1] * 26
        f[i] %= MOD
    return f[-1]


if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    i8 = numba.from_dtype(np.int64)
    signature = (i8, i8, i8)
    cc = CC('my_module')
    cc.export('main', signature)(main)
    cc.compile()

from my_module import main
K = int(readline())
N = len(readline())
print(main(K, N, MOD))