Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(20000)

N = int(input())
W = [list(map(int, input().split())) for _ in range(N-1)]
nodes = [[] for _ in range(N+1)]
for w in W:
    nodes[w[0]].append((w[1], w[2]))
    nodes[w[1]].append((w[0], w[2]))
ans = [-1] * (N+1)
ans[1] = 0
def search(num, root, dis):
    for node in nodes[num]:
        sum_d = dis
        if node[0] != root:
            idx = node[0]
            sum_d += node[1]%2
            if sum_d%2 != 0:
                ans[idx] = 1
            else:
                ans[idx] = 0
            search(idx, num, sum_d)

search(1, 0, 0)
for answer in ans[1:]:
    print(answer)


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

if K < len(A):
    ans = A[:K-1] + A[K-1].lower() + A[K:]
else:
    ans = A[:K-1] + A[K-1].lower()
print(ans)

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

A[K-1::] = A[k-1::].lower()
print(A)

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

if K < len(A):
    ans = A[:K-1] + A[K-1].lower() + A[K:]
else:
    ans = A[:K-1] + A[K-1].lower()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

answer = 0
for r in range(N//R+1):
  for g in range(N//G+1):
    if r*R + g*G > N or (N-r*R-g*G)%B != 0:
      continue
    else:
      answer += 1
print(answer)


Fixed submission:
R, G, B, N = map(int, input().split())

answer = 0
for r in range(N//R+1):
  for g in range(N//G+1):
    if r*R + g*G > N:
      break
    elif (N-r*R-g*G)%B != 0:
      continue
    else:
      answer += 1
print(answer)
Buggy python submission (verdict: Runtime Error):
dishes = [int(input()) for i in range(5)]

ans = 0
min_digits = 10
digits_idx = 0
for idx, dish in enumerate(dishes):
  ans += dish + 10 - dish%10
  if dish%10 < min_digits:
    digits_idx = idx
  	min_digits = dish%10
ans -= (10 - dishes[digits_idx]%10)
print(ans)


Fixed submission:
dishes = [int(input()) for i in range(5)]

ans = 0
min_digits = 10
digits_idx = 0
for idx, dish in enumerate(dishes):
  if dish%10 == 0:
    ans += dish
  else:
    ans += dish + 10 - dish%10
  if dish%10 < min_digits and dish%10 !=0:
    digits_idx = idx
    min_digits = dish%10
if min_digits == 10:
  print(ans)
else:
  ans -= (10 - min_digits)
  print(ans)

Buggy python submission (verdict: Runtime Error):
dishes = [int(input()) for i in range(5)]

ans = 0
min_digits = 10
digits_idx = 0
for idx, dish in enumerate(dishes):
  ans += round(dish, -1)
  if dish%10 < mindigits:
    digits_idx = idx
  	min_digits = dish%10
ans = ans + dishes[digits_idx] - round(dishes[digits_idx], -1)
print(ans)

Fixed submission:
dishes = [int(input()) for i in range(5)]

ans = 0
min_digits = 10
digits_idx = 0
for idx, dish in enumerate(dishes):
  if dish%10 == 0:
    ans += dish
  else:
    ans += dish + 10 - dish%10
  if dish%10 < min_digits and dish%10 !=0:
    digits_idx = idx
    min_digits = dish%10
if min_digits == 10:
  print(ans)
else:
  ans -= (10 - min_digits)
  print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
cities = [int(input()) for i in range(N)]

min_city = min(cities)
if N < min_city:
  print(5)
else:
  times = N//min_city
  print(5+times)

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

min_city = min(cities)
if N <= min_city:
  print(5)
else:
  times = N//min_city
  if N%min_city == 0:
    print(5+times-1)
  else:
    print(5+times)
Buggy python submission (verdict: Time Limit Exceeded):
X, Y, Z, K = map(int, input().split())
a_cakes = list(map(int, input().split()))
b_cakes = list(map(int, input().split()))
c_cakes = list(map(int, input().split()))
a_b_cakes = []
for a in a_cakes:
  for b in b_cakes:
    a_b_cakes.append(a+b)
a_b_cakes.sort(reverse=True)
a_b_c_cakes = []
for a_b in a_b_cakes[:K]:
  for c in c_cakes:
    a_b_c_cakes.append(a_b+c)
a_b_c_cakes.sort(reverse=True)
for ans in a_b_c_cakes[:K]:
  print(ans)

Fixed submission:
X, Y, Z, K = map(int, input().split())
a_cakes = list(map(int, input().split()))
b_cakes = list(map(int, input().split()))
c_cakes = list(map(int, input().split()))
a_b_cakes = []
for a in a_cakes:
  for b in b_cakes:
    a_b_cakes.append(a+b)
a_b_cakes.sort(reverse=True)
a_b_c_cakes = []
for a_b in a_b_cakes[:K]:
  for c in c_cakes:
    a_b_c_cakes.append(a_b+c)
a_b_c_cakes.sort(reverse=True)
for ans in a_b_c_cakes[:K]:
  print(ans)
Buggy python submission (verdict: Runtime Error):
b = input()

bases = ('A', 'C', 'G', 'T')

for idx, base in enumerate(bases):
  if base == b:
    print(bases[int(~bin(idx))])
    break


Fixed submission:
b = input()

bases = ('A', 'C', 'G', 'T')

for idx, base in enumerate(bases):
  if base == b:
    print(bases[int(~(idx))])
    break

Buggy python submission (verdict: Runtime Error):
b = input()

bases = ['A', 'C', 'G', 'T']

for idx, base in enumerate(bases):
  if base == b:
    print(bases[int(~bin(idx))])

Fixed submission:
b = input()

bases = ('A', 'C', 'G', 'T')

for idx, base in enumerate(bases):
  if base == b:
    print(bases[int(~(idx))])
    break
Buggy python submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for j in range(N)]

ans = 0
for elem in A:
  sum_A = 0
  for j in range(M):
    sum_A += elem[i] * B[i]
  if sum_A + C > 0:
    ans += 1
print(ans)
    
  

Fixed submission:
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for j in range(N)]

ans = 0
for elem in A:
  sum_A = 0
  for j in range(M):
    sum_A += elem[j] * B[j]
  if sum_A + C > 0:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

N = len(S)

cnt_zero = 0
for i in range(N):
  if S[i] == '0':
    cnt += 1
if cnt_zero <= N - cnt_zero:
  print(cnt_zero*2)
else:
  print((N-cnt_zero)*2)

Fixed submission:
S = input()

N = len(S)

cnt_zero = 0
for i in range(N):
  if S[i] == '0':
    cnt_zero += 1
if cnt_zero <= N - cnt_zero:
  print(cnt_zero*2)
else:
  print((N-cnt_zero)*2)
Buggy python submission (verdict: Runtime Error):
A = input()

if int(A[6:8]) >= 5:
  print('TBD')
else:
  print('Heisei')

Fixed submission:
A = input()

if int(A[5:7]) >= 5:
  print('TBD')
else:
  print('Heisei')
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
	val, currency = input().split()
    if currency == 'JPY':
      ans += float(val)
    else:
      ans += float(val) * 380000.0
print(ans)


Fixed submission:
N = int(input())
ans = 0
for i in range(N):
  val, currency = input().split()
  if currency == 'JPY':
    ans += float(val)
  else:
    ans += float(val) * 380000.0
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
	value, currency = input().split()
    if currency == 'JPY':
      ans += float(value)
    else:
      ans += float(value) * 380000.0
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
  val, currency = input().split()
  if currency == 'JPY':
    ans += float(val)
  else:
    ans += float(val) * 380000.0
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
XU = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
  if XU[i][1] == 'JPN':
    ans += XU[i][0]
  else:
    ans += XU[i][0] * (380000.0)
print(ans)


Fixed submission:
N = int(input())
ans = 0
for i in range(N):
  val, currency = input().split()
  if currency == 'JPY':
    ans += float(val)
  else:
    ans += float(val) * 380000.0
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
XU = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
  if XU[i][1] == 'JPN':
    ans += XU[i][0]
  else:
    ans += XU[i][0] * 380000.0
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
  val, currency = input().split()
  if currency == 'JPY':
    ans += float(val)
  else:
    ans += float(val) * 380000.0
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
Lifes = map(int, input().split())

Lifes.sort(key=lambda x:-x)

ans = Lifes[N-1]

for i in range(N):
  for j in range(i, N):
    life = Lifes[i] - Lifes[j]
    if life > 0:
      ans = min(ans, life)
print(ans)


Fixed submission:
N = int(input())
Lifes = list(map(int, input().split()))

Lifes.sort(key=lambda x:-x)

ans = Lifes[N-1]

# for i in range(N):
#   for j in range(i, N):
#     life = Lifes[i]%Lifes[j]
#     if life > 0:
#       ans = min(ans, life)
# print(ans)

update = True
while update:
    min_num = ans
    for i in range(N):
        life_mod = Lifes[i]%ans
        if life_mod > 0:
            Lifes[i] = life_mod
            if min_num > life_mod:
                min_num = life_mod
    if ans == min_num:
        update=False
    else:
        ans = min_num
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
Lifes = map(int, input().split())

Lifes.sort(key=lambda x:-x)

ans = Lifes[N-1]

for i in range(N):
  for j in range(i, N):
    life = Lifes[i] - Lifes[j]
    if life > 0:
	  ans = min(ans, life)
print(ans)

Fixed submission:
N = int(input())
Lifes = list(map(int, input().split()))

Lifes.sort(key=lambda x:-x)

ans = Lifes[N-1]

# for i in range(N):
#   for j in range(i, N):
#     life = Lifes[i]%Lifes[j]
#     if life > 0:
#       ans = min(ans, life)
# print(ans)

update = True
while update:
    min_num = ans
    for i in range(N):
        life_mod = Lifes[i]%ans
        if life_mod > 0:
            Lifes[i] = life_mod
            if min_num > life_mod:
                min_num = life_mod
    if ans == min_num:
        update=False
    else:
        ans = min_num
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = map(int, input().split())

L.sort(key=lambda x:-x)

if L[0] >= sum(L[1::]):
  print('No')
else:
  print('Yes')

Fixed submission:
N = int(input())
L = list(map(int, input().split()))

L.sort(key=lambda x:-x)

if L[0] >= sum(L[1::]):
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))

if N >= M:
  print(0)
else:
  X.sort()

  diffs = [0]*(M-1)

  for i in range(M-1):
    diffs[i] = abs(x[i+1] - X[i])

  diffs.sort(key= lambda x: -x[0])
  
  print(sum(diffs[N-1:]))
  
  
  

  
  


Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))

if N >= M:
  print(0)
else:
  X.sort()

  diffs = [0]*(M-1)

  for i in range(M-1):
    diffs[i] = abs(X[i+1] - X[i])

  diffs.sort(key= lambda x: -x)

  print(sum(diffs[N-1:]))
Buggy python submission (verdict: Runtime Error):
S = int(input())

A = [S]
idx = 0
while True
  if A[idx] % 2 == 0:
    A.append(A[idx]//2)
  else:
    A.append(A[idx]*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+1)
    break
  idx += 1


Fixed submission:
S = int(input())

A = [S]
idx = 0
while True:
  if A[idx] % 2 == 0:
    A.append(A[idx]//2)
  else:
    A.append(A[idx]*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+2)
    break
  idx += 1

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

A = [S]
idx = 0
while True
  if A[idx] % 2 == 0:
    A.append(idx//2)
  else:
    A.append(idx*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+1)
    break
  idx += 1
      

Fixed submission:
S = int(input())

A = [S]
idx = 0
while True:
  if A[idx] % 2 == 0:
    A.append(A[idx]//2)
  else:
    A.append(A[idx]*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+2)
    break
  idx += 1
Buggy python submission (verdict: Runtime Error):
N = int(input())
items = [list(map(int, input().split())) for _ in range(N)]
v_max = 1000*100
INF = 10**18
dp = [[INF] * (v_max+1) for _ in range(N+1)]
for v in range(v_max+1):
  dp[0][v] = 0

for i in range(N):
  for v in range(v_max+1):
    if v >= items[i][1]:
      dp[i+1][v] = min(dp[i][v-items[i][1]]+items[i][0], dp[i][v])
    else:
      dp[i+1][v] = dp[i][v]

for v in range(v_max+1)[::-1]:
  if dp[N][v] <= W:
    print(v)
    break


Fixed submission:
N = int(input())
nums = list(map(int, input().split()))
INF = 10**10
dp = [INF] * (N)
dp[0] = 0
dp[1] = abs(nums[1]-nums[0])
for i in range(2, N):
  dp[i] = min(dp[i-2]+abs(nums[i]-nums[i-2]), dp[i-1]+abs(nums[i]-nums[i-1]))
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
N = int(input())
nums = list(map(int, input().split()))
INF = 10**10
dp = [INF] * (N)
dp[0] = 0
dp[1] = abs(nums[1]-nums[0])
for _ in range(2, N):
  dp[i] = min(dp[i-2]+abs(nums[i]-nums[i-2]), dp[i-1]+abs(nums[i]-nums[i-1]))
print(dp[N-1])

Fixed submission:
N = int(input())
nums = list(map(int, input().split()))
INF = 10**10
dp = [INF] * (N)
dp[0] = 0
dp[1] = abs(nums[1]-nums[0])
for i in range(2, N):
  dp[i] = min(dp[i-2]+abs(nums[i]-nums[i-2]), dp[i-1]+abs(nums[i]-nums[i-1]))
print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
nums = list(map(int, input().split()))
dp = [0] * (N+1)
dp[0] = 0
for i in range(1, N):
  min_c = 10**10
  for j in range(1, min(i, K)+1):
    min_c = min(min_c, dp[i-j]+abs(nums[i-j]-nums[i]))
  dp[i] = min_c
print(dp[N-1])

Fixed submission:
N, K = map(int, input().split())
nums = list(map(int, input().split()))
dp = [0] * (N+1)
dp[0] = 0
for i in range(1, N):
  min_c = 10**10
  for j in range(1, min(i, K)+1):
    min_c = min(min_c, dp[i-j]+abs(nums[i-j]-nums[i]))
  dp[i] = min_c
print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
items = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * (W+1) for _ in range(N+1)]
for i in range(N):
  for w in range(W+1):
    if w >= items[i][0]:
      dp[i+1][w] = max(dp[i][w-items[i][0]]+items[i][1], dp[i][w])
    else:
      dp[i+1][w] = dp[i][w]
print(dp[N][W])


Fixed submission:
N, W = map(int, input().split())
items = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * (W+1) for _ in range(N+1)]
for i in range(N):
  for w in range(W+1):
    if w >= items[i][0]:
      dp[i+1][w] = max(dp[i][w-items[i][0]]+items[i][1], dp[i][w])
    else:
      dp[i+1][w] = dp[i][w]
print(dp[N][W])
Buggy python submission (verdict: Runtime Error):
N, P = map(int, input().split())
p_dict = {}
for num in range(int(P*0.5)+1):
  while P%num == 0:
    if num in p_dict:
      p_dict[num] += 1
    else:
      p_dict[num] = 1

ans = 1
for k, v in p_dict.items():
  ans *= k**(N//v)
print(ans)

Fixed submission:
N, P = map(int, input().split())
p_dict = {}
if N == 1:
  print(P)
  exit()
for num in range(2, int(P**0.5)+1):
  while P%num == 0:
    if num in p_dict:
      p_dict[num] += 1
    else:
      p_dict[num] = 1
    P //= num
ans = 1
for k, v in p_dict.items():
  ans *= k**(v//N)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
min_diff = 10**5
for i in range(N):
  if abs((T - H[i]*0.006) - A) < min_diff:
    ans = i+1
    min_diff = abs((T - H[i]*0.006) - A)
print(ans)


Fixed submission:
X, Y = map(int, input().split())
print(X+Y//2)

Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input())
print((X+Y)//2)


Fixed submission:
X, Y = map(int, input().split())
print(X+Y//2)

Buggy python submission (verdict: Runtime Error):
X, Y = int(input())
print((X+Y)//2)

Fixed submission:
X, Y = map(int, input().split())
print(X+Y//2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
min_diff = 10*5
for i in range(N):
  if abs((T - H*0.006) - A) < min_diff:
    ans = i+1
    min_diff = abs((T - H*0.006) - A)
print(ans)


Fixed submission:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
min_diff = 10**5
for i in range(N):
  if abs((T - H[i]*0.006) - A) < min_diff:
    ans = i+1
    min_diff = abs((T - H[i]*0.006) - A)
print(ans)

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

ans = 0
min_diff = 10*5
for i in range(N):
  if abs((T - H*0.006) - A) < min_diff:
    ans = i+1
print(ans)

Fixed submission:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
min_diff = 10**5
for i in range(N):
  if abs((T - H[i]*0.006) - A) < min_diff:
    ans = i+1
    min_diff = abs((T - H[i]*0.006) - A)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = []
for i in range(M):
  P, Y = map(int, input().split())
  L.append((P, Y, i))
ans = ['']*(N)

L.sort(key=lambda x:(x[0], x[1]))
before = L[0][0]
num = 1
for i in range(M):
  if L[i][0] == before:
    num += 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
  else:
    num = 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
    before = L[i][0]
for city in ans:
  print(city)
    
  
  

Fixed submission:
N, M = map(int, input().split())
L = []
for i in range(M):
  P, Y = map(int, input().split())
  L.append((P, Y, i))
ans = ['']*(M)
L.sort(key=lambda x:(x[0], x[1]))
before = L[0][0]
num = 0
for i in range(M):
  if L[i][0] == before:
    num += 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
  else:
    num = 1
    id = '{:06d}'.format(L[i][0]) + '{:06d}'.format(num)
    ans[L[i][2]] = id
    before = L[i][0]
for city in ans:
  print(city)
Buggy python submission (verdict: Runtime Error):
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
for x in range(101):
  for y in range(101):
    before = -1
    identified = True
    for survey in surveys:
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if before != -1 and before != height:
        if survey[2] == 0:
          continue
        identified = False
        break
      if before == -1:
        before = height
    if identified:
      print(x, y, before)


Fixed submission:
N = int(input())
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A+B)

Buggy python submission (verdict: Runtime Error):
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
for x in range(101):
  for y in range(101):
    before = 0
    identified = True
    for survey in surveys:
      if survey[2] == 0:
        continue
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if before != 0 and before != height:
        identified = False
        continue
      before = height
    if identified:
      print(x, y, before)
      exit()


Fixed submission:
N = int(input())
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A+B)

Buggy python submission (verdict: Runtime Error):
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
for x in range(101):
  for y in range(101):
    before = 0
    identified = True
    for survey in surveys:
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if height != 0 and before != height:
        identified = False
        continue
      if height != 0:
        before = height
    if identified:
      print(x, y, before)


Fixed submission:
N = int(input())
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A+B)
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
ct = [list(map(int, input().split()), idx+1) for idx in range(N)]

costs = list(filter(lambda x: x[1] <= T, ct))
if len(costs) == 0:
  print('TLE')
else:
  costs.sort(key=lambda x: x[0])
  print(costs[0][2])

Fixed submission:
N, T = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(N)]
costs = list(filter(lambda x: x[1] <= T, ct))
if len(costs) == 0:
  print('TLE')
else:
  costs.sort(key=lambda x: x[0])
  print(costs[0][0])
Buggy python submission (verdict: Runtime Error):
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
for x in range(101):
  for y in range(101):
    before = -1
    identified = True
    for survey in surveys:
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if before != -1 and before != height:
        if surveys[2] == 0 and before <= height:
          continue
        identified = False
        break
      if before == -1:
        before = height
    if identified:
      print(x, y, before)


Fixed submission:
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
surveys.sort(key = lambda x:-x[2])
for x in range(101):
  for y in range(101):
    before = -1
    identified = True
    for survey in surveys:
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if before != -1 and before != height:
        if survey[2] == 0 and before < height:
          continue
        identified = False
        break
      if before == -1:
        before = height
    if identified:
      print(x, y, before)
      break
Buggy python submission (verdict: Runtime Error):
N = input()
for i in range(3):
  if N[i] == '1':
    N[i] = '9'
  elif N[i] == '9':
    N[i] == '1'
print(N)

Fixed submission:
N = input()
S = ''
for i in range(3):
  if N[i] == '1':
    S += '9'
  elif N[i] == '9':
    S += '1'
  else:
    S += N[i]
print(S)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [str(i) * 3 for i in range(10)[1:]]
for j in range(10)[1:]:
  if N >= A[j]:
    print(A[j])
    break

Fixed submission:
N = int(input())
A = [str(i) * 3 for i in range(1, 10)]
for j in range(9):
  if N <= int(A[j]):
    print(A[j])
    break
Buggy python submission (verdict: Runtime Error):
import math

N, M = map(int, input().split())
MOD = 10**9+7

def trial_division(n):
  #素因数を格納するリスト
  factor = []
  #2から√n以下の数字で割っていく
  tmp = int(math.sqrt(n)) + 1
  for num in range(2,tmp):
    cnt = 0
    while n % num == 0:
      n //= num
      cnt += 1 
    if cnt != 0:
      factor.append(cnt)
  #リストが空ならそれは素数
  if not factor:
    return factor
  else:
    if n != 1:
      factor.append(1)
    return factor

from operator import mul
from functools import reduce

def cmb(n,r):
  r = min(n-r,r)
  if r == 0: return 1
  over = reduce(mul, range(n, n - r, -1))
  under = reduce(mul, range(1,r + 1))
  return over // under

ans = 1
cnts = trial_division(M)
for cnt in cnts:
  ans = ans * (cmb(cnt+N-1, cnt))%MOD

print(cnts)
print(ans)

  
  

Fixed submission:
nums = list(map(int, input().split()))
nums.sort(key=lambda x: -x)
print(int(str(nums[0]) + str(nums[1])) + nums[2])

Buggy python submission (verdict: Runtime Error):
A, B, C = input()
print(max(int(A+B)+int(C),int(B+A)+int(C),int(A+C)+int(B), int(C+A)+int(B), int(B+C)int(A), int(C+B)+int(A)))

Fixed submission:
nums = list(map(int, input().split()))
nums.sort(key=lambda x: -x)
print(int(str(nums[0]) + str(nums[1])) + nums[2])