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

Fixed submission:
w = input()
weather = ["Sunny", "Cloudy", "Rainy"]

index = weather.index(w)
index += 1
if index == 3:
    index = 0

print(weather[index])

Buggy submission (verdict: Runtime Error):
w = input()
weather = ["Sunny", "Cloudy", "Rainy"]

index = weather.index(w)
index += 1
if index == 2:
    index = 0

print(weather[index])
Problem p02911 (python)

Fixed submission:
N, K, Q = input().split()
N = int(N)
K = int(K)
Q = int(Q)

A = []
for i in range(Q):
    A.append(int(input()))

people = []
for i in range(N):
    people.append(K - Q)

for i in A:
    people[i-1] += 1

for i in people:
    if i <= 0:
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
N, K, Q = input().split()
N = int(N)
K = int(K)
Q = int(Q)

A = []
for i in range(Q):
    A.append(int(input()))

people = []
for i in range(N):
    people.append(K-Q)

for i in A:
    people[i+1] += 1

for i in people:
    if i <= 0:
        print("No")
    else:
        print("Yes")
Problem p02614 (python)

Fixed submission:
import itertools
import numpy as np

h,w,k = list(map(int, input().split()))

matrix = np.empty((h,w), dtype = 'str')

for i in range(h):
    matrix[i] = list(input())

if np.count_nonzero(matrix=='#') == k:
    cnt = 1
else:
    cnt = 0

for n_row in range(h+1):
    for n_col in range(w+1):
        for r in itertools.combinations(range(h), n_row):
            for c in itertools.combinations(range(w), n_col):
                if not r and not c:
                    continue
                chg_matrix = matrix.copy()
                chg_matrix[:,c] = '&'
                chg_matrix[r,:] = '&'
                if np.count_nonzero(chg_matrix=='#') == k:
                    cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools

h,w,k = list(map(int, input().split()))

matrix = np.empty((h,w), dtype = 'str')

for i in range(h):
    matrix[i] = list(input())

if np.count_nonzero(matrix=='#') == k:
    cnt = 1
else:
    cnt = 0

for n_row in range(h+1):
    for n_col in range(w+1):
        for r in itertools.combinations(range(h), n_row):
            for c in itertools.combinations(range(w), n_col):
                if not r and not c:
                    continue
                chg_matrix = matrix.copy()
                chg_matrix[:,c] = '&'
                chg_matrix[r,:] = '&'
                if np.count_nonzero(chg_matrix=='#') == k:
                    cnt += 1

print(cnt)
Problem p02924 (python)

Fixed submission:

n = int(input())

if n % 2:
    print(n * (n - 1) // 2)
else:
    print(n * (n // 2 - 1) + n // 2)

Buggy submission (verdict: Runtime Error):

import numpy as np

n = int(input())
p = np.array(list(range(2, n + 1)) + [1])
mod = p - 1

print(sum(mod[:n-1]))
Problem p02642 (python)

Fixed submission:
import sys
import math

n = int(input())
a = list(map(int, input().split()))
a.sort()
limit = max(a)
dp = [True] * (limit + 1)
archives = set()
for i in a:
    if i in archives:
        dp[i] = False
        continue
    archives.add(i)
    n = 2
    while i * n <= limit:
        dp[i * n] = False
        n += 1

# print(dp)
ans = 0
for i in a:
    if dp[i] is True:
        ans += 1


print(ans)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))

p_all = set(range(0, 102)) - set(p)
# print(p_all)

mi = float('inf')
ans = 0
for i in p_all:
    if abs(x - i) < mi:
        mi = abs(x - i)
        ans = i

print(ans)
Problem p02678 (python)

Fixed submission:
#!/usr/bin/env python3
from collections import deque
# import sys
# input = sys.std.readline

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

que = deque()
dist = [float('inf')] * n
prev = [-1] * n
dist[0] = 0
que.append(0)
while que:
    now = que.popleft()
    for edge in edges[now]:
        if dist[edge] > dist[now] + 1:
            dist[edge] = dist[now] + 1
            prev[edge] = now + 1
            que.append(edge)


print('Yes')
for i in range(1, n):
    print(prev[i])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
from collections import deque
import sys
input = sys.std.readline

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

que = deque()
dist = [float('inf')] * n
prev = [-1] * n
dist[0] = 0
que.append(0)
while que:
    now = que.popleft()
    for edge in edges[now]:
        if dist[edge] > dist[now] + 1:
            dist[edge] = dist[now] + 1
            prev[edge] = now + 1
            que.append(edge)


print('Yes')
for i in range(1, n):
    print(prev[i])
Problem p02780 (python)

Fixed submission:
import sys
import numpy as np

input = sys.stdin.readline
n, k = map(int, input().split())

p = list(map(lambda x: (x + 1) / 2, map(int, input().split())))
# 1 - pi
# print(p)
p_cumsum = np.cumsum(p)
# print(p_cumsum)
ans = p_cumsum[k-1]

for i in range(0, n - k):
    # print(i, i + k)
    cum = p_cumsum[i + k] - p_cumsum[i]
    ans = max(ans, cum)


print('{:.12f}'.format(ans))

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline
n, k = map(int, input().split())

p = list(map(lambda x: (x + 1) / 2, map(int, input().split())))

# 1 - pi
ans = k
init = p[0]
for i in range(k, len(p)):
    if init < p[i]:
        init = p[i]
        ans = i

exp = 0
for i in range(ans - k + 1, ans + 1):
    exp += p[i]
print('{:.12f}'.format(exp))

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline
n, k = map(int, input().split())

p = list(map(lambda x: (x + 1) / 2, map(int, input().split())))

# 1 - pi
ans = k
init = p[0]
for i in range(k, len(p)):
    print(i)
    if init < p[i]:
        init = p[i]
        ans = i

exp = 0
for i in range(ans - k + 1, ans + 1):
    exp += p[i]
print('{:.12f}'.format(exp))
Problem p02801 (python)

Fixed submission:
c = input()

print(chr(ord(c) + 1))

Buggy submission (verdict: Runtime Error):
from collections import deque

H, W = map(int, input().split())
maze = []
for _ in range(H):
    maze.append(list(input()))


def successors(x, y):
    locations = []
    # 下に行けるかの判定
    if (x + 1 < H) and (maze[x + 1][y] != '#'):
        locations.append((x + 1, y))
    # 上に行けるかの判定
    if (x - 1 >= 0) and (maze[x - 1][y] != '#'):
        locations.append((x - 1, y))
    # 右に行けるかの判定
    if (y + 1 < W) and (maze[x][y + 1] != '#'):
        locations.append((x, y + 1))
    # 左に行けるかの判定
    if (y - 1 >= 0) and (maze[x][y - 1] != '#'):
        locations.append((x, y - 1))
    return locations


def bfs(initial, successors):
    # goal判定はなく、一番遠いところで返す
    frontier = deque()
    frontier.append((initial, None))
    # tuple
    explored = {initial}

    while len(frontier):
        current_node = frontier.popleft()
        current_state = current_node[0]
        for child in successors(*current_state):
            if str(child) in [str(i) for i in explored]:
                continue
            explored.add(child)
            frontier.append((child, current_node))
    return current_node


def node_to_path_count(node):
    counter = 0
    while node[1] is not None:
        counter += 1
        node = node[1]
    return counter


ans = 0
for x in range(H):
    for y in range(W):
        if maze[x][y] == '.':
            solution = bfs((x, y), successors)
            counter = node_to_path_count(solution)
            if ans < counter:
                ans = counter

print(ans)
Problem p03161 (python)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf')] * n

dp[0] = 0

for i in range(1, n):
    for j in range(1, k+1):
        if i - j < 0:
            continue
        dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]))

print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf') for _ in range(n)]
dp[0] = 0

for i in range(1, n):
    if i- k > 0:
        s = i - k
    else:
        s = 0
    dp[i] = min(d + abs(h[i] - h) for d, h in zip(dp[s:i], h[s:i]))

print(dp[-1])
Problem p03229 (python)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

A.sort()

if len(A) % 2 == 1:
    order1 = [-1, -1]
    for i in range(len(A)-2):
        if i % 2 == 0:
            order1.append(2)
        else:
            order1.append(-2)

    order2 = [1, 1]
    for i in range(len(A)-2):
        if i % 2 == 0:
            order2.append(-2)
        else:
            order2.append(2)
else:
    order1 = [-1, 1]
    for i in range(len(A) - 2):
        if i % 2 == 0:
            order1.append(2)
        else:
            order1.append(-2)

    order2 = [-1, 1]
    for i in range(len(A) - 2):
        if i % 2 == 0:
            order2.append(-2)
        else:
            order2.append(2)


order1.sort()
order2.sort()

sum1 = 0
sum2 = 0
for x, y, z in zip(A, order1, order2):
    sum1 += x * y
    sum2 += x * z

print(max(sum1, sum2))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]

A.sort()
right = A[:int(len(A) / 2)]
left = A[int(len(A) / 2):]

max_list = []

if len(right) == 1:
    max_list = [left[0], right[0], left[1]]
else:

    while True:
        if right:
            max_list.append(right.pop())
        if left:
            max_list.append(left.pop())

        if len(right) == 0 and len(left) == 0:
            break

ans = 0
for i in range(len(max_list)-1):
    ans += abs(max_list[i] - max_list[i+1])

print(ans)
Problem p03238 (python)

Fixed submission:
pattern = int(input())

if pattern == 1:
    print("Hello World")
elif pattern == 2:
    a = int(input())
    b = int(input())

    print(a + b)

Buggy submission (verdict: Runtime Error):
route_num, limit = map(int, input().split(' '))

costs = []
spends = []
for i in range(route_num):
    cost, spend = map(int, input().split(' '))
    costs.append(cost)
    spends.append(spend)

min_cost = 2000
for cost, spend in zip(costs, spends):
    if spend <= limit and cost < min_cost:
        min_cost = cost

if min_cost == 2000:
    print("TLE")

else:
    print(min_cost)
Problem p03240 (python)

Fixed submission:
N = int(input())

coords = [list(map(int, input().split(' '))) for _ in range(N)]

coords.sort(key=lambda x: x[2], reverse=True)

# 全探索
def search():
    for Cx in range(101):
        for Cy in range(101):
            x, y, h = tuple(coords[0])
            H = h + abs(Cx - x) + abs(Cy - y)
            for x, y, h in coords:
                if max(H - abs(Cx - x) - abs(Cy - y), 0) != h:
                    break
            else:
                return Cx, Cy, H

x, y, h = search()
print("{} {} {}".format(x, y, h))

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

coords = [list(map(int, input().split(' '))) for _ in range(N)]

coords.sort(key=lambda x: x[2], reverse=True)

# 全探索
def search():
    for Cx in range(101):
        for Cy in range(101):
            x, y, h = tuple(coords[0])
            H = h + abs(Cx - x) + abs(Cy - y)
            for x, y, h in coords:
                if max(H - abs(Cx - x) - abs(Cy - y), 0) != h:
                    break
            else:
                return (Cx, Cy, H)

print("{} {} {}".format(search()))

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

coords = [list(map(int, input().split(' '))) for _ in range(N)]

coords.sort(key=lambda x: x[2], reverse=True)

# 全探索
def search():
    for Cx in range(101):
        for Cy in range(101):
            x, y, h = coords[0]
            H = h + abs(Cx - x) + abs(Cy - y)
            for x, y, h in coords:
                if max(H - abs(Cx - x) - abs(Cy - y), 0) != h:
                    break
            else:
                return (Cx, Cy, H)

print("{} {} {}".format(search()))
Problem p03633 (python)

Fixed submission:
from collections import deque
N = int(input())


# 最大公約数
def gcd(a, b):
    while b > 0:
        a, b = b, a%b
    return a


# 最小公倍数
def lcm(a, b):
    return a*b//gcd(a, b)


array = []
for _ in range(N):
    array.append(int(input()))

ans = array[0]
for x in array[1:]:
    ans = lcm(ans, x)


print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
N = int(input())


# 最大公約数
def gcd(a, b):
    while b > 0:
        a, b = b, a%b
    return a


# 最小公倍数
def lcm(a, b):
    return a*b/gcd(a, b)


array = deque()
for _ in range(N):
    array.append(int(input()))

if len(array) == 1:
    print(array[0])

while len(array) > 1:
    a = array.pop()
    b = array.pop()
    array.append(lcm(a, b))

print(int(array[0]))

Buggy submission (verdict: Runtime Error):
from functools import lru_cache
from collections import deque
N = int(input())


# 最大公約数
def gcd(a, b):
    while b > 0:
        a, b = b, a%b
    return a


# 最小公倍数
def lcm(a, b):
    return a*b/gcd(a, b)


array = deque()
for _ in range(N):
    array.append(int(input()))

#@lru_cache(maxsize = None)
#def multi_lcm():

while len(array) > 1:
    a = array.pop()
    b = array.pop()
    array.append(lcm(a, b))

print(int(array[0]))
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
ans = []
x = 0
if n > 1:
    for i in range(1,n):
        if h[i-1] <= h[i]:
            x += 1
        else:
            ans.append(x)
            x = 0
    ans.append(x)
else:
    ans.append(0)
print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
ans = []
x = 0
if n > 1:
    for i in range(1,n):
        if h[i-1] <= h[i]:
            x += 1
        else:
            ans.append(x)
            x = 0
else:
    ans.append(0)
print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
ans = []
x = 0
if n > 1:
    for i in range(1,n):
        if h[i-1] <= h[i]:
            x += 1
        else:
            ans.append(x)
            x = 0
else:
    ans = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
ans = []
x = 0
for i in range(1,n):
    if h[i-1] <= h[i]:
        x += 1
    else:
        ans.append(x)
        x = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
ans = 0
h1 = sorted(h, reverse=True)
if h1[0] == h[0]:
    for i in range(n):
        if h[i] >= h[i + 1]:
            ans += 1
        else:
            x = h[ans + 1:]
            if ans < len(x[x.index(max(x)):]):
                ans = len(x[x.index(max(x)):])
            break
else:
    ans = len(h[h.index(h1[0])+1:])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
ans = 0
h = h[1:]
h1 = sorted(h, reverse=True)
ans = len(h[h.index(h1[0])+1:])
print(ans)
Problem p02924 (python)

Fixed submission:
n = int(input())
ans = n * (n-1) // 2    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = n(n-1) // 2    
print(ans)
Problem p03037 (python)

Fixed submission:
n,m = map(int,input().split())
L = []
R = []
for i in range(m):
    l,r = map(int,input().split())
    L.append(l)
    R.append(r)
ans = 0
L = max(L)
R = min(R)
for i in range(1,n+1):
    if L <= i and R >= i:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(m):
    b,c = map(int,input().split())
    a.extend([c] * b)
a.sort(reverse=True)
print(sum(a[:n]))
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = a + b + c + d + e
l = []
for i in a,b,c,d,e:
    k = 10-i%10
    if k != 10:
        l.append(k)
if len(l) != 0:
    l.pop(l.index(max(l)))
    ans += sum(l)

print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
l = []
for i in a,b,c,d,e:
    k = 10-i%10
    if k != 10:
        l.append(k)
l.pop(l.index(max(l)))
ans = a + b + c + d + e + sum(l)
print(ans)
Problem p03085 (python)

Fixed submission:
B = input()
if B == 'A':
    ans = 'T'
elif B == 'T':
    ans = 'A'
elif B == 'C':
    ans = 'G'
elif B == 'G':
    ans = 'C'
print(ans)

Buggy submission (verdict: Runtime Error):
N,Q = map(int,input().split())
S = input()
l =[map(int,input().split()) for i in range(Q)]

for i,x in l:
    s1 = S[i-1:x]
    print(s1.count('AC'))
Problem p03105 (python)

Fixed submission:
A,B,C = map(int,input().split())
ans = 0

while B >= A and C != ans:
    B -= A
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input('A'))
b = int(input('B'))
c = int(input('C'))

count = 0
for i in range(b // a):
    if i >= c:
        break
    count += 1

print(count)
Problem p03106 (python)

Fixed submission:
A,B,K = map(int,input().split())
l = []
for i in range(1,min(A,B)+1):
    if A % i == 0 and B % i == 0:
        l.append(i)
l.reverse()
print(l[K - 1])

Buggy submission (verdict: Runtime Error):
try:
  a = int(input('A'))
  b = int(input('B'))
  k = int(input('K'))
except EOFError:
  a = 8
  b = 12
  k = 2 
count = 0
kcount = 0
while True:
    count += 1
    if a % count == 0 and b % count == 0:
        kcount += 1
    if k == kcount:
        break

print(count)

Buggy submission (verdict: Runtime Error):
a = int(input('A'))
b = int(input('B'))
k = int(input('K'))

count = 0
kcount = 0
while True:
    count += 1
    if a % count == 0 and b % count == 0:
        print(count)
        kcount += 1
    if k == kcount:
        break

print(count)
Problem p03360 (python)

Fixed submission:
a, b, c = map(int, input().split())
k = int(input())

for i in range(k):
    maxnum = max(a, b, c)
    if maxnum == a:
        a *= 2
    elif maxnum == b:
        b *= 2
    elif maxnum == c:
        c *= 2
print(a + b + c)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
k = int(input())

for i in range(k):
    maxnum = max(a, b, c)
    if maxnum == a:
        a *= 2
    elif maxnum == b:
        b *= 2
    elif maxnum == c:
        c *= 2
print(sum(a, b, c))
Problem p03486 (python)

Fixed submission:
s = sorted(list(input()))
t = sorted(list(input()), reverse=True)
s = "".join(s)
t = "".join(t)
ans = 'No'
if s < t:
    ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())
s = "".join(s.sort())
t = "".join(t.sort())
ans = 'No'
if s < t:
    ans = 'Yes'
print(ans)
Problem p03609 (python)

Fixed submission:
x, t = map(int, input().split())
ans = x - t
if ans < 0:
  ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
x, t = map(int, input().split())
ans = x - t
if ans < 0:
  ans = 0
 print(ans)
Problem p03737 (python)

Fixed submission:
s1, s2, s3 = input().split()
ans = (s1[0]+s2[0]+s3[0]).upper()
print(ans)

Buggy submission (verdict: Runtime Error):
s1, s2, s3 = input().split()
ans = (s1[0]+s2[0]+s3[3]).upper()
print(ans)
Problem p03759 (python)

Fixed submission:
a, b, c = map(int, input().split())
ans = 'NO'
if b - a == c - b:
  ans = 'YES'
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
ans = 'NO'
if b - a == c = b:
  ans = 'YES'
print(ans)
Problem p04043 (python)

Fixed submission:
a, b, c = input().split()
abc = sorted([a, b, c])
ans = 'NO'
if abc[0] == '5' and abc[1] == '5' and abc[2] == '7':
  ans = 'YES'
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, c = input().split()
abc = sorted([a, b, c])
ans = 'NO'
if abc[0] == '5' and abc[1] == '5' and = abc[2] == '7':
  ans = 'YES'
print(ans)
Problem p02630 (python)

Fixed submission:
data = {}
total = 0
N = int(input())

for a in input().split():
    a = int(a)
    data[a] = data.get(a, 0) + 1
    total += a

Q = int(input())

for _ in range(Q):
    b, c = map(int, input().split())
    diff = c - b
    count = data.get(b)
    if count:
        data[c] = data.get(c, 0) + data.pop(b)
        total += diff * count
    print(total)

Buggy submission (verdict: Runtime Error):
data = {}
total = 0
N = int(input())

for a in input().split():
    a = int(a)
    data[a] = data.get(a, 0) + 1
    total += a

Q = int(input())

for _ in range(Q):
    b, c = map(int, input().split())
    diff = c - b
    count = data.get(b)
    total += diff * count
    if count: data[c] = data.get(c, 0) + data.pop(b)
    print(total)
Problem p02687 (python)

Fixed submission:
x=input()
if x=="ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
string x=input()
if x=="ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
x=string(input())
if x=="ABC":
    print("ARC")
else:
    print("ABC")
Problem p02631 (python)

Fixed submission:
import sys

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N = ni()
A_array = na()

A = 0

for a in A_array:
    A = A ^ a

ans_array = [A ^ a for a in A_array]

print(" ".join(map(str, ans_array)))

Buggy submission (verdict: Runtime Error):
 import sys

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N = ni()
A_array = na()

A = 0

for a in A_array:
    A = A ^ a

ans_array = [A ^ a for a in A_array]

print(" ".join(map(str, ans_array)))
Problem p02632 (python)

Fixed submission:
import sys

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces

# 大きい数用


mod = 10**9 + 7
N = 10 ** 6 + 1  # 出力の制限
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)

K = ni()
S = ns()
s_len = len(S)
mod = 10 ** 9 + 7
ans = 0

total = K + s_len

rui = 1

cmb = 1

for i in range(total, s_len - 1, -1):
    # print(total - i + 1)
    ans = (ans + cmb * rui) % mod
    # print(ans)
    rui = (rui * 25) % mod
    cmb = (cmb * i * inverse[total - i + 1]) % mod
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces

# 大きい数用


mod = 10**9 + 7
N = 10 ** 6  # 出力の制限
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)


K = ni()
S = ns()
s_len = len(S)
mod = 10 ** 9 + 7
ans = 0

total = K + s_len

rui = 1

cmb = 1

for i in range(total, s_len - 1, -1):
    ans = (ans + cmb * rui) % mod
    # print(ans)
    rui = (rui * 25) % mod
    cmb = (cmb * i * inverse[total - i + 1]) % mod
print(ans)