Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
for i in range(1,n):
    al[i]+=al[i-1]
for i in range(1,m):
    bl[i]+=bl[i-1]
ans=0
j=m-1
for i in range(n):
    if al[i]>k:
        break
    while bl[j]>k-al[i]:
        j-=1
    ans=max(ans,i+j+2)
print(ans)


Fixed submission:
n,m,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
aa,bb=[0],[0]
for i in range(n):
    aa.append(aa[i]+al[i])
for i in range(m):
    bb.append(bb[i]+bl[i])
ans=0
j=m
for i in range(n+1):
    if aa[i]>k:
        break
    while bb[j]>k-aa[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
for i in range(1,n):
    al[i]+=al[i-1]
for i in range(1,m):
    bl[i]+=bl[i-1]
ans=0
j=m-1
for i in in range(n):
    if al[i]>k:
        break
    while bl[j]>al[i]-k:
        j-=1
    ans=max(ans,i+j)
print(ans)


Fixed submission:
n,m,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
aa,bb=[0],[0]
for i in range(n):
    aa.append(aa[i]+al[i])
for i in range(m):
    bb.append(bb[i]+bl[i])
ans=0
j=m
for i in range(n+1):
    if aa[i]>k:
        break
    while bb[j]>k-aa[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
for i in range(1,n):
    al[i]+=al[i-1]
for i in range(1,m):
    bl[i]+=bl[i-1]
ans=0
j=m
for i in in range(n):
    if al[i]>k:
        break
    while bl[j]>al[i]-k:
        j-=1
    ans=max(ans,i+j)
print(ans)


Fixed submission:
n,m,k=map(int,input().split())
al=[int(i) for i in input().split()]
bl=[int(i) for i in input().split()]
aa,bb=[0],[0]
for i in range(n):
    aa.append(aa[i]+al[i])
for i in range(m):
    bb.append(bb[i]+bl[i])
ans=0
j=m
for i in range(n+1):
    if aa[i]>k:
        break
    while bb[j]>k-aa[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
z=(v*t)+a
y=(w*t)+b
if w>=v:
    print("NO")
    break
if z-y>=0:
    print("YES")
else:
    print("NO")


Fixed submission:
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
z=(v*t)
y=(w*t)
if z-y>=abs(b-a):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
l=[int(i) for i in input().split()]
mul=1
for i in l:
    mul*=i
if mul>10**18:
    print(-1)
else:
    print(mul)
    

Fixed submission:
a=int(input())
l=[int(i) for i in input().split()]
mul=1
f=0
if 0 in l:
    print(0)
else:
    for i in l:
        mul*=i
        if mul>10**18:
            f=1
            print(-1)
            break
    if f==0:
        print(mul)
Buggy python submission (verdict: Runtime Error):
n =int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[n])

Fixed submission:
n =int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[n-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[n])

Fixed submission:
n =int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
from math import inf
n,h=map(int,input().split())
l=[int(i) for i in input().split()]
Inf=10**10
dp=[Inf]*n
dp[0]=0
dp[1]=abs(l[1]-l[0])
for i in range(2,n):
    for j in range(1,min(i,h)+1):
        dp[i]=min(dp[i],dp[i-j]+abs(l[i]-l[i-j]))
print(dp[-1])

Fixed submission:
def main():
    N,K = map(int,input().split())
    h = list(map(int,input().split()))
    INF = 10**10
    DP = [INF]*N
    DP[0] = 0
    DP[1] = abs(h[1]-h[0])
    for i in range(2,N):
        DP[i] = min(DP[i-j] + abs(h[i-j]-h[i]) for j in range(1,min(K,i)+1))
    print(DP[-1])
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from math import inf
n,h=map(int,input().split())
l=[int(i) for i in input().split()]
dp=[inf]*n
dp[0]=0
dp[1]=abs(l[1]-l[0])
for i in range(2,n):
    dp[i]=min(dp[i-j]+abs(l[i-j]-l[i]) for j in range(1,min(i,h)+1))
print(dp[-1])

Fixed submission:
def main():
    N,K = map(int,input().split())
    h = list(map(int,input().split()))
    INF = 10**10
    DP = [INF]*N
    DP[0] = 0
    DP[1] = abs(h[1]-h[0])
    for i in range(2,N):
        DP[i] = min(DP[i-j] + abs(h[i-j]-h[i]) for j in range(1,min(K,i)+1))
    print(DP[-1])
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from math import inf
n,h=map(int,input().split())
l=[int(i) for i in input().split()]
dp=[inf]*n
dp[0]=0
dp[1]=abs(l[1]-l[0])
for i in range(2,n):
    for j in range(1,min(i,h)+1):
        dp[i]=min(dp[i],dp[i-j]+abs(l[i-j]-l[i]))
print(dp[-1])

Fixed submission:
def main():
    N,K = map(int,input().split())
    h = list(map(int,input().split()))
    INF = 10**10
    DP = [INF]*N
    DP[0] = 0
    DP[1] = abs(h[1]-h[0])
    for i in range(2,N):
        DP[i] = min(DP[i-j] + abs(h[i-j]-h[i]) for j in range(1,min(K,i)+1))
    print(DP[-1])
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from math import inf
n,h=map(int,input().split())
l=[int(i) for i in input().split()]
dp=[inf]*n
dp[0]=0
dp[1]=abs(l[1]-l[0])
for i in range(2,n):
    for j in range(1,min(i,h)+1):
        dp[i]=min(dp[i],dp[i-j]+abs(l[i]-l[i-j]))
print(dp[-1])

Fixed submission:
def main():
    N,K = map(int,input().split())
    h = list(map(int,input().split()))
    INF = 10**10
    DP = [INF]*N
    DP[0] = 0
    DP[1] = abs(h[1]-h[0])
    for i in range(2,N):
        DP[i] = min(DP[i-j] + abs(h[i-j]-h[i]) for j in range(1,min(K,i)+1))
    print(DP[-1])
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
  MOD = int(1e9 + 7)
  n = int(input())
  print((pow(10,n,MOD) - 2*pow(9 , n , MOD)%MOD + pow(8 , n , MOD) + MOD)%MOD)

if __namme__ == "__main__":
  main()

Fixed submission:
def main():
  MOD = int(1e9 + 7)
  n = int(input())
  print((pow(10,n,MOD) - 2*pow(9 , n , MOD)%MOD + pow(8 , n , MOD) + MOD)%MOD)
 
if __name__ == "__main__":
  main()
Buggy python submission (verdict: Runtime Error):
def main():
  n = int(input())
  a_li , b_li = [] , []
  for _ in range(n):
    x , y = int(input())
    a_li.append(x + y)
    b_li.append(x - y)
    print(max(max(a_li) - min(a_li), max(b_li) - min(b_li)))

if __name__ == "__main__":
  main()

Fixed submission:
def main():
  n = int(input())
  a_li , b_li = [] , []
  for _ in range(n):
    x , y = map(int,input().split())
    a_li.append(x + y)
    b_li.append(x - y)
  print(max(max(a_li) - min(a_li), max(b_li) - min(b_li)))
 
if __name__ == "__main__":
  main()
Buggy python submission (verdict: Runtime Error):
l,r,d = map(int,input().split())
print(r//d-(l-1)//d))

Fixed submission:
l,r,d = map(int,input().split())
print(r//d-(l-1)//d)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = input()
one_num = x.count('1')

ans_reduce,ans_add = 0,0
for i in range(n):
    if(one_num>1):
        ans_reduce = (ans_reduce+pow(2,n-i-1,one_num-1)*(1 if x[i] == '1' else 0))%(one_num-1)
    ans_add = (ans_add+pow(2,n-i-1,one_num+1)*(1 if x[i] == '1' else 0))%(1+one_num)

for i in range(n):
    now_one = one_num + (-1 if x[i] == '1' else 1)
    num = ((ans_reduce if x[i] == '1' else ans_add) + pow(2,n-i-1,now_one)*(-1 if x[i] == '1' else 1))%now_one
    ans = 1
    while(num!=0):
        ans += 1
        num = num % bin(num).count('1')
    print(ans)


Fixed submission:
n = int(input())
x = input()
one_num = x.count('1')

ans_reduce,ans_add = 0,0
for i in range(n):
    if(one_num>1):
        ans_reduce = (ans_reduce+pow(2,n-i-1,one_num-1)*(1 if x[i] == '1' else 0))%(one_num-1)
    ans_add = (ans_add+pow(2,n-i-1,one_num+1)*(1 if x[i] == '1' else 0))%(1+one_num)

for i in range(n):
    now_one = one_num + (-1 if x[i] == '1' else 1)
    if(now_one == 0):
        print(0)
        continue
    num = ((ans_reduce if x[i] == '1' else ans_add) + pow(2,n-i-1,now_one)*(-1 if x[i] == '1' else 1))%now_one
    ans = 1
    while(num!=0):
        ans += 1
        num = num % bin(num).count('1')
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
n = int(input())
a = list(map(int, input().split()))
b = a[0]
for i in range(1, n): b = math.gcd(b, a[i])
if b != 1: print("not coprime")
else:
    data = primes(10**6)
    count = [0]*(len(data))
    for i in range(n):
        for j in range(len(data)):
            if a[i]%data[j] == 0: count[j] += 1
    x = 0
    for i in range(1, len(count)):
        x = max(x, count[i])
    print("setwise coprime") if x > 1 else print("pairwise coprime")

Fixed submission:
from math import gcd, sqrt
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
n = int(input())
a = list(map(int, input().split()))
b = a[0]
for i in range(1, n): b = gcd(b, a[i])
if b != 1: print("not coprime")
else:
    data = primes(10**6)
    c = [1]*(10**6+1)
    for i in range(1, 10**6+1):
        for j in range(len(data)):
            if i < data[j]**2: break
            if i%data[j] == 0: c[i] = data[j]; break
        if c[i] == 1: c[i] = i
    d = [0]*(10**6+1)
    for i in range(n):
        while a[i] > 1:
            d[c[a[i]]] += 1
            e = c[a[i]]
            while a[i]%e == 0: a[i] //= e
    print("setwise coprime") if max(d[2:]) > 1 else print("pairwise coprime")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))
maximum = -10**9
for i in range(n):
    totalfull = 0; totalcut = 0; count = 0; location = i
    maximumfull = -10**9; maximumcut = -10**9
    for j in range(min(n, k)):
        location = p[location]-1
        totalfull += c[location]
        maximumfull = max(maximumfull, totalfull)
        count += 1
        if location == i: break
    for j in range(k%count):
        location = p[location]-1
        totalcut += c[location]
        maximumcut = max(maximumcut, totalcut)
    maximum = max(maximum, max(maximumfull, max((k//count-1)*totalfull+maximumfull, k//count*totalfull+maximumcut)))
print(maximum)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))
maximum = -10**9
for i in range(n):
    totalfull = 0; totalcut = 0; count = 0; location = i
    maximumfull = -10**9; maximumcut = -10**9
    for j in range(min(n, k)):
        location = p[location]-1
        totalfull += c[location]
        maximumfull = max(maximumfull, totalfull)
        count += 1
        if location == i: break
    for j in range(k%count):
        location = p[location]-1
        totalcut += c[location]
        maximumcut = max(maximumcut, totalcut)
    maximum = max(maximum, max(maximumfull, max((k//count-1)*totalfull+maximumfull, k//count*totalfull+maximumcut)))
print(maximum)
Buggy python submission (verdict: Time Limit Exceeded):
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0]*(n+1)
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i&-i
        return s
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i&-i
n, q = map(int, input().split())
c = list(map(int, input().split()))
last = [-1]*n
foradd = [[] for i in range(n)]
for i in range(n):
    if last[c[i]-1] != -1: foradd[last[c[i]-1]].append(i)
    last[c[i]-1] = i
forsum = [[] for i in range(n)]
for i in range(q):
    l, r = map(int, input().split()); l -= 1; r -= 1
    forsum[l].append([r, i])
bit = Bit(n); ans = [-1]*q
for i in range(n-1, -1, -1):
    for j in foradd[i]: bit.add(j, 1)
    for j in forsum[i]: ans[j[1]] = j[0]-i+1-bit.sum(j[0])
print(*ans, sep="\n")

Fixed submission:
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0]*(n+1)
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i&-i
        return s
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i&-i
n, q = map(int, input().split())
c = list(map(int, input().split()))
last = [-1]*n
foradd = [[] for i in range(n)]
for i in range(n):
    if last[c[i]-1] != -1: foradd[last[c[i]-1]].append(i)
    last[c[i]-1] = i
forsum = [[] for i in range(n)]
for i in range(q):
    l, r = map(int, input().split()); l -= 1; r -= 1
    forsum[l].append([r, i])
bit = Bit(n); ans = [-1]*q
for i in range(n-1, -1, -1):
    for j in foradd[i]: bit.add(j, 1)
    for j in forsum[i]: ans[j[1]] = j[0]-i+1-bit.sum(j[0])
print(*ans, sep="\n")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [0 for _ in range(10000)]
for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            b = i*i+j*j+k*k+i*j+j*k+k*i-1
            if b < 10000:
                a[b] += 1
for i in range(n):
    print(a[n])

Fixed submission:
n = int(input())
a = [0]*n
s = int(n**(1/2))+1
for i in range(1, s):
    for j in range(1, s):
        for k in range(1, s):
            b = i*i+j*j+k*k+i*j+j*k+k*i-1
            if b < n:
                a[b] += 1
for i in range(n):
    print(a[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
for i in range(1, n+1):
    a = 0
    for x in range(1, int(i**(1/2))):
        for y in range(x, int((i-x**2)**(1/2))):
            for z in range(y, int((i-x**2-y**2)**(1/2))):
                if x**2+y**2+z**2+x*y+y*z+z*x == i:
                    if x == y and y == z and z == y:
                        a += 1
                    elif x ==y or y == z or z == y:
                        a += 3
                    else:
                        a += 6
    print(a)

Fixed submission:
n = int(input())
a = [0]*n
s = int(n**(1/2))+1
for i in range(1, s):
    for j in range(1, s):
        for k in range(1, s):
            b = i*i+j*j+k*k+i*j+j*k+k*i-1
            if b < n:
                a[b] += 1
for i in range(n):
    print(a[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
for i in range(1, n+1):
    a = 0
    for x in range(1, 100):
        for y in range(x, int((10000-x**2)**(1/2))):
            for z in range(y, int((10000-x**2-y**2)**(1/2))):
                if x**2+y**2+z**2+x*y+y*z+z*x == i:
                    if x == y and y == z and z == y:
                        a += 1
                    elif x ==y or y == z or z == y:
                        a += 3
                    else:
                        a += 6
    print(a)

Fixed submission:
n = int(input())
a = [0]*n
s = int(n**(1/2))+1
for i in range(1, s):
    for j in range(1, s):
        for k in range(1, s):
            b = i*i+j*j+k*k+i*j+j*k+k*i-1
            if b < n:
                a[b] += 1
for i in range(n):
    print(a[i])
Buggy python submission (verdict: Runtime Error):
d = int(input())
c = {}
s = []
C = list(map(int, input().split()))
for i in range(26):
    c[i] = C[i]
for i in range(d):
    s.append(list(map(int, input().split())))

t = 0
while t < 365:
    for i in range(26):
        if t < 365:
            t += 1
            a = -1
            b = 0
            for j in range(26):
                if b < s[t][j]:
                    a = j
                    b = s[t][j]
            print(a+1)
        else:
            break;
        if t < 365:
            t += 1
            print(26-i)
        else:
            break;

Fixed submission:
d = int(input())
c = {}
s = []
C = list(map(int, input().split()))
for i in range(26):
    c[i] = C[i]
for i in range(d):
    s.append(list(map(int, input().split())))

for i in range(d):
    a = -1
    b = 0
    for j in range(26):
        if b < s[i][j]:
            a = j
            b = s[i][j]
    print(a+1)
Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [0]
d = [0]
for i in range(n):
    c.append(a[i]+c[i])
for i in range(m):
    d.append(b[i]+d[i])
e = 0
for i in range(n+1):
    if a[i] > k:
        break;
    while b[m] > k-a[i]:
        m -= 1
    e = max(e, i+m)
print(e)

Fixed submission:
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [0]
d = [0]
for i in range(n):
    c.append(a[i]+c[i])
for i in range(m):
    d.append(b[i]+d[i])
e = 0
for i in range(n+1):
    if c[i] > k:
        break;
    while c[i]+d[m] > k:
        m -= 1
    e = max(e, i+m)
print(e)

Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [0]
d = [0]
for i in range(n):
    c.append(a[i]+c[i])
for i in range)m:
    d.append(b[i]+d[i])
e = 0
for i in range(n+1):
    if a[i] > k:
        break;
    while b[m] > k-a[i]:
        m -= 1
    e = max(e, i+m)
print(e)

Fixed submission:
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [0]
d = [0]
for i in range(n):
    c.append(a[i]+c[i])
for i in range(m):
    d.append(b[i]+d[i])
e = 0
for i in range(n+1):
    if c[i] > k:
        break;
    while c[i]+d[m] > k:
        m -= 1
    e = max(e, i+m)
print(e)

Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
for i in range(1, n):
    a[i] += a[i-1]
for i in range(1, m):
    b[i] += b[i-1]
for i in range(n):
    if a[i] > k:
        break;
    while a[i]+b[m-1] > k:
        m -= 1    
        if m == 0:
            break;
    c = max(c, i+m+1)
print(c)

Fixed submission:
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [0]
d = [0]
for i in range(n):
    c.append(a[i]+c[i])
for i in range(m):
    d.append(b[i]+d[i])
e = 0
for i in range(n+1):
    if c[i] > k:
        break;
    while c[i]+d[m] > k:
        m -= 1
    e = max(e, i+m)
print(e)

Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
for i in range(1, n):
    a[i] += a[i-1]
for i in range(1, m):
    b[i] += b[i-1]
for i in range(n):
    if a[i] > k:
        break;
    while a[i]+b[m-1] > k:
        m -= 1
    c = max(c, i+m+1)
print(c)

Fixed submission:
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [0]
d = [0]
for i in range(n):
    c.append(a[i]+c[i])
for i in range(m):
    d.append(b[i]+d[i])
e = 0
for i in range(n+1):
    if c[i] > k:
        break;
    while c[i]+d[m] > k:
        m -= 1
    e = max(e, i+m)
print(e)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
s = input()
p = 1000000007
x = 0
inv = [0, 1]
fact = [1, 1]
factinv = [1, 1]
for i in range(2, k+len(s)+1):
    inv.append(-inv[p%i]*(p//i)%p)
    fact.append(fact[-1]*i%p)
    factinv.append(factinv[-1]*inv[-1]%p)
def cmb(n, r, p):
    return fact[n]*factinv[r]*factinv[n-r]%p
a = [1]
b = [1]
for _ in range(k):
    a.append(a[-1]*25%p)
    b.append(b[-1]*26%p)
for i in range(k+1):
    x = (x+a[i]*b[k-i]*cmb(i+len(s)-1, i, p))%p
print(x)

Fixed submission:
k = int(input())
s = input()
p = 1000000007
x = 0
inv = [0, 1]
fact = [1, 1]
factinv = [1, 1]
for i in range(2, k+len(s)+1):
    inv.append(-inv[p%i]*(p//i)%p)
    fact.append(fact[-1]*i%p)
    factinv.append(factinv[-1]*inv[-1]%p)
def cmb(n, r, p):
    return fact[n]*factinv[r]*factinv[n-r]%p
a = [1]
b = [1]
for _ in range(k):
    a.append(a[-1]*25%p)
    b.append(b[-1]*26%p)
for i in range(k+1):
    x = (x+a[i]*b[k-i]*cmb(i+len(s)-1, i, p))%p
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(min(k, 50)):
    b = [0]*(n+1)
    for i in range(n):
        b[max(0, i-a[i])] += 1
        b[min(i+a[i]+1, n)] -= 1
    for i in range(1, n+1):
        b[i] += b[i-1]
    for i in range(n):
        a[i] = b[i]
print(*a)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(min(k, 50)):
    b = [0]*(n+1)
    for i in range(n):
        b[max(0, i-a[i])] += 1
        b[min(i+a[i]+1, n)] -= 1
    for i in range(1, n+1):
        b[i] += b[i-1]
    for i in range(n):
        a[i] = b[i]
print(*a)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = [0]*n
c = [0]*n
for i in range(n):
    for j in range(a[i]+1):
        if j == 0:
            b[i] += 1
        else:
            if j <= i:
                b[i-j] +=1
            if j <= n-1-i:
                b[i+j] +=1
for l in range(min(k-1, 50)):
    for i in range(n):
        if b[i]-a[i] > 0:
            for j in range(a[i]+1, b[i]+1):
                if j <= i:
                    c[i-j] += 1
                if j <= n-1-i:
                    c[i+j] += 1
        elif b[i]-a[i] < 0:
            for j in range(b[i]+1, a[i]+1):
                if j <= i:
                    c[i-j] -= 1
                if j <= n-1-i:
                    c[i+j] -= 1
    for i in range(n):
        a[i] = b[i]
        b[i] += c[i]
        c[i] = 0
print(*b)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(min(k, 50)):
    b = [0]*(n+1)
    for i in range(n):
        b[max(0, i-a[i])] += 1
        b[min(i+a[i]+1, n)] -= 1
    for i in range(1, n+1):
        b[i] += b[i-1]
    for i in range(n):
        a[i] = b[i]
print(*a)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(min(k, 41)):
    b = [0]*n
    for j in range(n):
        for l in range(a[j]+1):
            if j >= l:
                b[j-l] += 1
            if n-1-j >= l:
                b[j+l] += 1
            if l == 0:
                b[j] -= 1
    a = b
print(*a)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(min(k, 50)):
    b = [0]*(n+1)
    for i in range(n):
        b[max(0, i-a[i])] += 1
        b[min(i+a[i]+1, n)] -= 1
    for i in range(1, n+1):
        b[i] += b[i-1]
    for i in range(n):
        a[i] = b[i]
print(*a)
Buggy python submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
if k <= a+b:
    print(min(a, k)
else:
    print(2*a+b-k)

Fixed submission:
a, b, c, k = map(int, input().split())
if k <= a+b:
    print(min(a, k))
else:
    print(2*a+b-k)