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

Fixed submission:
n = int(input())
h = int(input())
w = int(input())
print((n + 1 - h) * (n + 1 - w))

Buggy submission (verdict: Runtime Error):
import itertools
import sys
sys.setrecursionlimit(2000)
h, w = map(int, input().split())
s_list = []
for i in range(h):
  s_list.append(list(input()))
res = 0
check_list = set()

def rec_create_area(point, tmp_area, current_str):
  new_point_list = []
  new_point_list.append((point[0] + 1, point[1]))
  new_point_list.append((point[0], point[1] + 1))
  new_point_list.append((point[0] - 1, point[1]))
  new_point_list.append((point[0], point[1] - 1))
  for new_point in new_point_list:
    if new_point[0] >= h or new_point[1] >= w or new_point[0] < 0 or new_point[1]  < 0:
      continue
    if new_point in check_list:
      continue
    new_str = s_list[new_point[0]][new_point[1]]
    if new_str == current_str:
      continue
    if new_str == "#":
      tmp_area[0] += 1
    else:
      tmp_area[1] += 1
    check_list.add(new_point)
    rec_create_area(new_point, tmp_area, new_str)
  
for a, b in itertools.product(range(h), range(w)):
  check_point = (a, b)
  if check_point in check_list:
    continue
  check_list.add(check_point)
  current_str = s_list[check_point[0]][check_point[1]]
  if current_str == "#":
    tmp_area = [1, 0]
  else:
    tmp_area = [0, 1]
  rec_create_area(check_point, tmp_area, current_str)
  res += tmp_area[0] * tmp_area[1]
  
print(res)

Buggy submission (verdict: Runtime Error):
import itertools
h, w = map(int, input().split())
s_list = []
for i in range(h):
  s_list.append(list(input()))
area_list = []
check_list = set()

def rec_create_area(point, tmp_area, current_str):
  new_point_list = []
  new_point_list.append((point[0] + 1, point[1]))
  new_point_list.append((point[0], point[1] + 1))
  for new_point in new_point_list:
    if new_point[0] >= h or new_point[1] >= w:
      continue
    if new_point in check_list:
      continue
    new_str = s_list[new_point[0]][new_point[1]]
    if new_str == current_str:
      continue
    if new_str == "#":
      tmp_area[0] += 1
    else:
      tmp_area[1] += 1
    check_list.add(new_point)
    rec_create_area(new_point, tmp_area, new_str)
  
for a, b in itertools.product(range(h), range(w)):
  check_point = (a, b)
  if check_point in check_list:
    continue
  check_list.add(check_point)
  current_str = s_list[0][0]
  if current_str == "#":
    tmp_area = [1, 0]
  else:
    tmp_area = [0, 1]
  rec_create_area(check_point, tmp_area, current_str)
  area_list.append(tmp_area)
  
print(sum([x[0] * x[1] for x in area_list]))
Problem p03280 (python)

Fixed submission:
a, b = input().split()

print((int(a) - 1) * (int(b) - 1))

Buggy submission (verdict: Runtime Error):
import math

s = input()
k = math.log10(int(input()))
index_num = 0
pow_num = 5000000000000000
if k == 0:
  print(s[0])
  exit()
for i in s:
  new_index_num = index_num  + math.log10(int(i)) * pow_num
  if k > index_num and k <= new_index_num:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
import math

def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def prime_factorization_2(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        dict_counter = {}
        for prime in prime_list:
            while num % prime == 0:
                if prime in dict_counter:
                    dict_counter[prime] += 1
                else:
                    dict_counter[prime] = 1
                num //= prime
        if num != 1:
            if num in dict_counter:
                dict_counter[num] += 1
            else:
                dict_counter[num] = 1

        return dict_counter

def search_divisor_num_2(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        divisor_num = 1
        dict_fact = prime_factorization_2(num)
        for value in dict_fact.values():
            divisor_num *= (value + 1)
        return divisor_num

eight_list = []
for i in range(100):
    ii = i * 2 + 1
    if search_divisor_num_2(ii) == 8:
        eight_list.append(ii)

n = int(input())
use_list = [1 for i in eight_list if i <= n]
print(sum(use_list))
Problem p03341 (python)

Fixed submission:
input()
ss = input()
loss = ss[1:].count("E")
min_loss = loss
ss_before = ss[:-1]
ss_after = ss[1:]
for b, a in zip(ss_before, ss_after):
    loss += b == "W"
    loss -= a == "E"
    if loss < min_loss:
        min_loss = loss
print("{}".format(min_loss))

Buggy submission (verdict: Runtime Error):
input()
ss = input()
loss = ss[1:].count("E")
min_loss = loss
ss_before = ss[:-1]
ss_after = ss[1:]
for b, a in zip(ss_before, ss_after):
    loss += b == "W"
	loss -= a == "E"
    if loss < min_loss:
        min_loss = loss
print("{}".format(min_loss))
Problem p02741 (python)

Fixed submission:
arr=[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]
t=int(input())
print(arr[t-1])

Buggy submission (verdict: Runtime Error):
import math
a,b,c=input().split();
if (math.sqrt(float(a)) + math.sqrt(float(b))) <= math.sqrt(float(c)):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import math
a,b,c=input().split();
if math.sqrt(float(a) + float(b)) < math.sqrt(float(c)):
  print("Yes")
else:
  print("No")
Problem p02646 (python)

Fixed submission:
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

kyori = abs(a - b)
sokudo = v-w

if kyori<=t*sokudo:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

kyori = abs(a - b)
sokudo = v-w

if kyori=<t*sokudo:
  print('YES')
else:
  print('NO')
Problem p02664 (python)

Fixed submission:
t = list(input())
for i in range(len(t)):
  if t[i]=='?':
    if i==0:
      t[i]='?'
    if t[i-1]=='P':
      t[i]='D'
    else:
      t[i]='D'
      

print(''.join(t))

Buggy submission (verdict: Runtime Error):
t = list(input())
for i in len(t):
  if t[i]=='?':
    if i==0:
      t[i]='?'
    if t[i-1]=='D':
      t[i]='P'
    else:
      t[i]='D'
      
print(t)
Problem p02687 (python)

Fixed submission:
def main():
  s = input()
  if s == 'ABC':
    print('ARC')
  else:
    print('ABC')


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  s = input()
  if s == 'ABC':
    print('ARC')
  else:
    print('ABC')


  print(ans)

if __name__ == '__main__':
  main()
Problem p03424 (python)

Fixed submission:
N = int(input())
s = input().split()
if "Y" in s:
    print("Four")
else:
    print("Three")

Buggy submission (verdict: Runtime Error):
num = int(input())
data = input().rstrip().split(' ')
count = 0
if data.count('P') > 0 or data.count('W') > 0 or data.count('G') > 0 or data.count('Y') > 0:
  count++

if count == 3:
  print('Three')
elif count == 4:
  print('Four')

Buggy submission (verdict: Runtime Error):
num = int(input())
data = input().rstrip().split(' ')
count = 0
if data.count('P') > 0 or data.count('W') > 0 or data.count('G') > 0 or data.count('Y') > 0:
  count++
print(count)
Problem p02719 (python)

Fixed submission:
N,K = map(int,input().split())
if K == 1:
  print(0)
else:
  a = N%K
  b = abs(N%K - K)
  ans = min(a,b)
  print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
if K == 1:
  print(0)
else:
  while N > 0:
    N -= K
  ans = min(N+K,abs(N))
print(ans)
Problem p02748 (python)

Fixed submission:
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = [0]*M
y = [0]*M
c = [0]*M
for i in range(M):
  x[i],y[i],c[i] = map(int,input().split())
ans = 10**10
ma = max(c)
#ind = c.index(ma)
am = min(a)
bm = min(b)
mae = am + bm #ここまで
#indxy = a[x[ind]-1] + b[y[ind]-1] - ma

for i in range(M):
  mai = a[x[i]-1] + b[y[i] -1] - c[i]
  if mai < ans:
    ans = mai
if mae < ans:
  print(mae)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = [0]*M
y = [0]*M
z = [0]*M
for i in range(M):
  x[i],y[i],z[i] = map(int,input().split())
zsort = sorted(z)
ma = max(zsort)
ind = z.index(ma)
am = min(a)
bm = min(b)
mae = am + bm
indxy = a[ind-1] + b[ind-1] - ma


if mae < indxy:
  print(mae)
else:
  print(indxy)

Buggy submission (verdict: Runtime Error):
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = [0]*M
y = [0]*M
z = [0]*M
for i in range(M):
  x[i],y[i],z[i] = map(int,input().split())
zsort = sorted(z)
mi = zsort[-1]
ind = z.index(mi)
am = min(a)
bm = min(b)
mae = am + bm
indxy = a[ind-1] + b[ind-1] - mi


if mae < indxy:
  print(mae)
else:
  print(indxy)
Problem p02755 (python)

Fixed submission:
A,B = map(int,input().split())
mina= 100
minb=100
a = set()
b = set()
C = A/0.08
D= B/0.1
E=(A+1)/0.08
F=(B+1)/0.1 
if C.is_integer() ==False:
  C= A//0.08 +1
if D.is_integer() ==False:
  D= B//0.1 +1

if E.is_integer() ==False:
  E= (A+1)//0.08 

if F.is_integer() ==False:
  F= (B+1)//0.1

C=int(C)
D=int(D)
E=int(E)
F=int(F)
for i in range(C,E):
  a.add(i)
for i in range(D,F):
  b.add(i)
c = a&b
d = list(c)
d.sort()
if len(d) ==0:
  print(-1)
else:
  print(d[0])

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
mina= 100
minb=100
a = set()
b = set()
C = A/0.08
D= B/0.08
E = (A+1)/0.08
F= (B+1)/0.08
if C.is_integer() ==False:
  C= C//0.08 +1

if D.is_integer() ==False:
  D= D//0.08

if E.is_integer() ==False:
  E= E//0.08 +1

if F.is_integer() ==False:
  F= F//0.08

for i in range(C,D):
  a.add(i)

for i in range(E,F):
  b.add(i)
c = a&b
d = list(c)
d.sort()
if d[0] == True:
  print(d[0])
else:
  print(-1)
Problem p02765 (python)

Fixed submission:
N,R = map(int,input().split())
if N >= 10:
  print(R)
else:
  print(R+100*(10-N))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from collections import deque
N = int(input())
graph = [deque([]) for _ in range(N)]
has = []
stack = []
for i in range(N):
  u,k,* v = [int(x) for x in input().split()]
  v.sort()
  for j in v:
    graph[u-1].append(j)
time = 0
arrive_time = [-1]*N

def dfs(x):
  stack.append(x)#探索スタート地点を「探索候補スタック」に積む
  while stack:#stackが空になるまで
    v = stack.pop()
    has.append(v)#探索済みリストに取り出した地点を格納（ここが現在地点）    
    for i in graph[v-1]:
      if i in has:
        continue
      elif i in stack:
        continue
      else:
        stack.append(i)
  print(*has)
dfs(1)
Problem p02768 (python)

Fixed submission:
n,a,b = map(int,input().split())
inf = 10**9 +7
ans = pow(2,n,inf)-1
def conbi(n,k):
  if n-k < k:
    k = n-k
  x = 1
  y = 1
  for i in range(k):
    x *= n-i
    x = x%inf
    y *= i+1
    y = y%inf
  ans = x* pow(y,inf-2,inf)%inf
  return ans
ans  -= conbi(n,a) + conbi(n,b)
ans = ans%inf
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
inf = 10**9 +7
ans = pow(2,n,inf)-1
def conbi(n,k):
  if n-k < k:
    k = n-k
  x = 1
  y = 1
  for i in range(k):
    x *= n-i
    x = x%inf
    y *= i+1
    y = y%inf
    ans = x* pow(y,inf-2,inf)%inf
  return ans
ans  -= conbi(n,a) + conbi(n,b)
ans = ans%inf
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
inf = 10**9 +7
ans = pow(2,n,inf)-1
def conbi(n,k):
  if n-k < k:
    k = n-k
  x = 1
  y = 1
  for i in range(k):
    x *= n-i
    x = x%inf
    y *= i+1
    y = y%inf
    ans1 = x* pow(y,inf-2,inf)%inf
  return ans1
sol = ans - conbi(n,a)- conbi(n,b)
print(sol%inf)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
inf = 10**9 +7
ans = pow(2,n,inf)-1
def conbi(n,k):
  if n-k < k:
    k = n-k
  x = 1
  y = 1
  for i in range(k):
    x *= n-i
    x = x%inf
    y *= i+1
    y = y%inf
    ans1 = x* pow(y,inf-2,inf)%inf
  return ans1
print(conbi(n,a))
sol = ans - conbi(n,a)- conbi(n,b)
print(sol)
Problem p02783 (python)

Fixed submission:
N,M = (int(x) for x in input().split())
 
K = int(N/M)
if N < M:
  print(1)
elif N%M == 0:
  print(K)
else:
  print(K+1)

Buggy submission (verdict: Runtime Error):
N,M = (int(x) for x in input().split())

K = N/M
if N < M:
  print(1)
else if N > M && N%M == 0:
  print(K)
else:
  print(K+1)
Problem p02784 (python)

Fixed submission:
H,N = map(int,input().split())
M = list(map(int,input().split()))
 
ans = 0       
for i in M:
    ans = ans + i
if H > ans:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
H,N = map(int,input().split())
M = list(map(int,input().split())

ans = 0       
for i in M:
    ans = ans + i
if h > ans:
    print("No)
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
H,N = map(int,input().split())
M = list(map(int,input().split())

ans = 0       
for i in M:
  ans = ans + i
if h > ans:
  print("No)
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
H,N = map(int,input().split())
M = list(map(int,input().split())

ans = 0       
for i in M:
    ans = ans + i
if h > ans:
         print("No)
else:
               print("Yes")
Problem p02789 (python)

Fixed submission:
N,M = (int(x) for x in input().split())

if N == M:
  print("Yes")
else:
  print('No')

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

if N == M:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = input();
M = input();

if N == M:
  print('Yes')
else:
  print('No')
Problem p02801 (python)

Fixed submission:
a = input()
print(chr(ord(a) + 1))

Buggy submission (verdict: Runtime Error):
a = input()
print chr(ord('a') + 1)

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

ans = chr(ord('N'+1))

print(ans)
Problem p02811 (python)

Fixed submission:
N,M = (int(x) for x in input().split())
 
if N*500 >= M:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,M = (int(x) for x in input().split())

if N*5 > = M:
  print('Yes')
else:
  print('No')
Problem p02817 (python)

Fixed submission:
S,T = map(str,input().split())

print(T+S)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

print(T+S)
Problem p02830 (python)

Fixed submission:
N = int(input())

A,B = input().split()
for i in range(N):
  print(A[i],end = "")
  print(B[i],end = "")

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

A,B = input().split()

for i in range(N):
  Z = Z + A[i]+B[i]

print(Z)
Problem p02910 (python)

Fixed submission:
N = input()

M = int(len(N))
flag = True

for i in range(M):
  if i % 2 == 0:
    if N[i] == "L":
      flag = False
  else:
    if N[i] == "R":
      flag = False
if flag == False:
  print('No')
else:
  print('Yes')

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

M = int(len(N))//2
flag = True

for i in range(M+1):
  if N[i*2] == "R":
    flag = False
  elif N[i*2+1] == "L":
    flag = False
if flag == True:
  print('No')
else:
  print('Yes')
Problem p02993 (python)

Fixed submission:
S = input()
flag = True
for i in range(3):
  if S[i] == S[i+1]:
    flag = False
if flag == True:
  print("Good")
else:
  print("Bad")

Buggy submission (verdict: Runtime Error):
S = int(input())
flag = True
for i in range(3):
  if S[i] == S[i+1]:
    flag = False
if flag == True:
  print("Good")
else:
  print("Bad")
Problem p03000 (python)

Fixed submission:
N,X = map(int,input().split())
L = list(map(int,input().split()))
zahyou = 0
count = 0

for i in range(N):
  if zahyou <= X:
    zahyou +=  L[i]
    count += 1
if zahyou <= X:
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())
L = list(map(int,input().split()))
zahyou = 0
count = 0

for i in range(N+1):
  if zahyou <= X:
    zahyou +=  L[i]
    count += 1
print(count)
Problem p02945 (python)

Fixed submission:
a,b=(int(x) for x in input().split())

c=a+b
d=a-b
e=a*b

print(max(c,d,e))

Buggy submission (verdict: Runtime Error):
from math import factorial

num=int(input())
count=0

#for i in range(num):
#    str=input()
#    str=''.join(sorted(str))
#    str = ''.join(sorted(input()))
#    stl.append(str)
stl =[(''.join(sorted(input()))) for i in range(num)]

duplicate=[x for x in set(stl) if stl.count(x) > 1]
if duplicate:
    for dup in duplicate:
        n=stl.count(dup)
        count += factorial(n) // 2 // factorial(n - 2)
    
print(count)

Buggy submission (verdict: Runtime Error):
from math import factorial

num=int(input())
stl=[]

count=0

for i in range(num):
    str=input()
    str=''.join(sorted(str))
    stl.append(str)

duplicate=[x for x in set(stl) if stl.count(x) > 1]
if duplicate:
    for dup in duplicate:
        n=stl.count(dup)
        count += factorial(n) // 2 // factorial(n - 2)
    
print(count)

Buggy submission (verdict: Runtime Error):
from math import factorial

num=int(input())
stl=[]

count=0

for i in range(num):
    str=input()
    str=''.join(sorted(str))
    stl.append(str)

duplicate=[x for x in set(stl) if stl.count(x) > 1]
if duplicate:
    for dup in duplicate:
        n=stl.count(dup)
        count += factorial(n) // ( factorial(n - 2) * 2 )
    
print(count)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()

P = list(map(int, input().split()))
t = 100
for i in range(0,102):
  if not i in P:
    if t > abs(i - x):
      t = abs(i - x)
      ans = i

print(ans)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()

P = list(map(int, input().split()))
t = x
for i in range(101):
  if not i in P:
    if t > abs(i - x):
      t = abs(i - x)
      ans = i
      
print(ans)
Problem p02657 (python)

Fixed submission:
a, b = map(int, input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split)
print(a*b)
Problem p02675 (python)

Fixed submission:
import sys

n = sys.stdin.readline().rstrip()
hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
bon = [3]
if int(n[-1]) in hon:
    print('hon') 
elif int(n[-1]) in pon:
    print('pon')
elif int(n[-1]) in bon:
    print('bon')

Buggy submission (verdict: Runtime Error):
n = sys.stdin.readline().rstrip()
hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
bon = [3]
if int(n[-1]) in hon:
    print('hon') 
elif int(n[-1]) in pon:
    print('pon')
elif int(n[-1]) in bon:
    print('bon')
Problem p02677 (python)

Fixed submission:
import sys
import math

A, B, H, M = map(int, sys.stdin.readline().split())
theta = (H * 30 + M * 0.5)  - (M * 6)
ans = math.sqrt((A**2 + B**2) - (2 * A * B) * math.cos(math.radians(theta)))
print('{:.20f}'.format(ans))

Buggy submission (verdict: Runtime Error):
import sys
import math

def resolve():
A, B, H, M = map(int, sys.stdin.readline().split())
theta = (H * 30 + M * 0.5)  - (M * 6)
ans = math.sqrt((A**2 + B**2) - (2 * A * B) * math.cos(math.radians(theta)))
print('{:.20f}'.format(ans))
Problem p02678 (python)

Fixed submission:
import sys
from collections import deque

N, M=map(int, sys.stdin.readline().split())
p = []
for i in range(M):
    p.append(list(map(int, sys.stdin.readline().split())))

graph = [[] for _ in range(N + 1)]
for pi in p:
    graph[pi[0]].append(pi[1])
    graph[pi[1]].append(pi[0])

q = deque([1])
p = [0] * (N + 1)
p[1] = 1
while q:
    u = q.popleft()
    for v in graph[u]:
        if not p[v]:
            p[v] = u
            q.append(v)
            
result = p[2:]
        
if all(result):
    print("Yes")
    [print(r) for r in result] 
else:
    print("No")

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

N, M=map(int, sys.stdin.readline().split())
p = []
for i in range(M):
    p.append(list(map(int, sys.stdin.readline().split())))

graph = [[] for _ in range(N + 1)]
for pi in p:
    graph[pi[0]].append(pi[1])
    graph[pi[1]].append(pi[0])

q = deque([1])
p = [0] * (N + 1)
p[1] = 1
while q:
    u = q.popleft()
    for v in graph[u]:
        if not p[v]:
            p[v] = u
            q.append(v)
            
result = p[2:]
        
if all(result):
    print("Yes")
    [print(r) for r in result] 
else:
    print("No")
Problem p03994 (python)

Fixed submission:
S = list(input())
N = int(input())

'''
ordの位置
#z = 122
#a = 97
左の文字からNで'a'に出来るかを確認
aに出来るならaにして使った分をNから引く
繰り返して行き一番最後にあまりをすべて使う
'''
  
for i, s in enumerate(S):
  if ord(s) - 97 > 0  and 122 - ord(s) < N:
    S[i] = "a"
    N -= 123 - ord(s)
else:
  S[i] = chr(N % 26 + ord(S[i])) # ここのWAは反省する
       
print("".join(S))

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

'''
ordの位置
#z = 122
#a = 97
左の文字からNで'a'に出来るかを確認
aに出来るならaにして使った分をNから引く
繰り返して行き一番最後にあまりをすべて使う'''
  
for i, s in enumerate(S):
  if ord(s) - 97 > 0  and 122 - ord(s) < N:
    S[i] = "a"
    N -= 123 - ord(s)
else:
  S[i] = chr((ord(S[i]) + N))
  
print("".join(S))
Problem p02848 (python)

Fixed submission:
N, S = int(input()), input()


def rot_encode(n):
    from string import ascii_lowercase as lc, ascii_uppercase as uc
    lookup = str.maketrans(lc + uc, lc[n:] + lc[:n] + uc[n:] + uc[:n])
    return lambda s: s.translate(lookup)


print(rot_encode(N)(S))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from EmurateInput import input

N, S = int(input()), input()


def rot_encode(n):
    from string import ascii_lowercase as lc, ascii_uppercase as uc
    lookup = str.maketrans(lc + uc, lc[n:] + lc[:n] + uc[n:] + uc[:n])
    return lambda s: s.translate(lookup)


print(rot_encode(N)(S))
Problem p02900 (python)

Fixed submission:
from fractions import gcd


def prime_factors(n):
    i = 2

    factors = []

    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)

    return factors


A, B = [int(x) for x in input().split()]

print(len(set(prime_factors(gcd(A, B)))) + 1)

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


def is_prime(n):
    return n != 1 and not np.any(n % np.arange(2, n) == 0)


A, B = [int(x) for x in input().split()]

N = np.arange(1, min(A, B) + 1)

cd = np.argwhere((A % N == 0) & (B % N == 0)).ravel() + 1
primes = [n for n in cd if is_prime(n)]

print(len(primes) + 1)

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


def is_prime(n):
    return n != 1 and not np.any(n % np.arange(2, n) == 0)


A, B = [int(x) for x in input().split()]

N = np.arange(1, min(A, B))

if N.size == 0:
    print(1)
else:
    cd = np.argwhere((A % N == 0) & (B % N == 0)).ravel() + 1
    primes = [n for n in cd if is_prime(n)]

    print(len(primes) + 1)
Problem p02911 (python)

Fixed submission:
import numpy as np

N, K, Q = [int(x) for x in input().split()]

A = list()
while True:
    try:
        A.append(int(input()))
    except EOFError:
        break

scores = np.full((N), K - Q)

for a in A:
    scores[a - 1] += 1

for score in scores:
    print("Yes" if score > 0 else "No")

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

N, K, Q = [int(x) for x in input().split()]

A = list()
while True:
    line = input()
    if line:
        A.append(int(line))
    else:
        break

scores = np.zeros((N), dtype=np.int32)

for a in A:
    scores[[i for i in range(N) if i != (a - 1)]] -= 1

scores = scores + K

for score in scores:
    print("Yes" if score > 0 else "No")