Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()
len_s = len(S)
ok = True
for i in range(len_s):
  for j in range(i+1, len_s):
    if (S[i] == S[j] and T[i] != T[j]) or (S[i] != S[j] and T[i] == T[j]):
      ok = False
      break
  else:
    continue
  break
if ok:
  print('Yes')
else:
  print('No')


Fixed submission:
S = input()
T = input()
len_s = len(S)
ok = True
s_dict = {}
t_dict = {}
for i in range(len_s):
  if S[i] in s_dict and s_dict[S[i]] != T[i]:
    ok = False
    break
  if T[i] in t_dict and t_dict[T[i]] != S[i]:
    ok = False
    break
  s_dict[S[i]] = T[i]
  t_dict[T[i]] = S[i]
if ok:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()
len_s = len(S)
ok = True
for i in range(len_s):
  for j in range(i+1, len_s):
    if (S[i] == S[j] and T[i] != T[j]) or (S[i] != S[j] and T[i] == T[j]):
      ok = False
      break
if ok:
  print('Yes')
else:
  print('No')


Fixed submission:
S = input()
T = input()
len_s = len(S)
ok = True
s_dict = {}
t_dict = {}
for i in range(len_s):
  if S[i] in s_dict and s_dict[S[i]] != T[i]:
    ok = False
    break
  if T[i] in t_dict and t_dict[T[i]] != S[i]:
    ok = False
    break
  s_dict[S[i]] = T[i]
  t_dict[T[i]] = S[i]
if ok:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()
len_s = len(S)
ok = True
for i in range(len_s):
  for j in range(i+1, len_s):
    if (S[i] == S[j] and T[i] != T[j]) or (S[i] != S[j] and T[i] == T[j]):
      ok = False
      break
if ok:
  print('Yes')
else:
  print('No')

Fixed submission:
S = input()
T = input()
len_s = len(S)
ok = True
s_dict = {}
t_dict = {}
for i in range(len_s):
  if S[i] in s_dict and s_dict[S[i]] != T[i]:
    ok = False
    break
  if T[i] in t_dict and t_dict[T[i]] != S[i]:
    ok = False
    break
  s_dict[S[i]] = T[i]
  t_dict[T[i]] = S[i]
if ok:
  print('Yes')
else:
  print('No')
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 'prime number'
  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(ans)

  
  

Fixed submission:
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 []
  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)
Buggy python submission (verdict: Runtime Error):
import fractions

N, X = int(input())
cities = list(map(int, input().split()))
gcds = 0
for city in cities:
  if gcd == 0:
    gcds = fractions.gcd(abs(city-X))
  else:
    gcds = fractions.gcd(gcds, abs(city-X))
print(gcds)

Fixed submission:
import fractions

N, X = map(int, input().split())
cities = list(map(int, input().split()))
gcds = abs(cities[0]-X)
for city in cities[1:]:
  gcds = fractions.gcd(gcds, abs(city-X))
print(gcds)
Buggy python submission (verdict: Runtime Error):
K = int(input)
if K%2 == 0:
  print((K//2)**2)
else:
  print((K//2)*(K//2+1))

Fixed submission:
K = int(input())
if K%2 == 0:
  print((K//2)**2)
else:
  print((K//2)*(K//2+1))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]

L = []
R = []

for i in range(H):
  R_cnt = 0
  for j in range(W):
    if A[i][j] == '.':
      R_cnt += 1
  if R_cnt == W:
    R.append(i)

for j in range(W):
  L_cnt = 0
  for i in range(H):
    if A[i][j] == '.':
      L_cnt += 1
  if L_cnt == H:
    L.append(j)

for i in range(H):
  S = []
  for j in range(W):
    if i in R or j in L:
      break
    else:
      S.append(A[i][j])
  print(' '.join(S))

Fixed submission:
H, W = map(int, input().split())
A = [list(input()) for _ in range(H)]

L = []
R = []

for i in range(H):
  R_cnt = 0
  for j in range(W):
    if A[i][j] == '.':
      R_cnt += 1
  if R_cnt == W:
    R.append(i)

for j in range(W):
  L_cnt = 0
  for i in range(H):
    if A[i][j] == '.':
      L_cnt += 1
  if L_cnt == H:
    L.append(j)

for i in range(H):
  S = []
  for j in range(W):
    if i in R:
      break
    elif j in L:
      continue
    else:
      S.append(A[i][j])
  if len(S) > 0:
    print(''.join(S))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 3*10**5
for i range(N):
  if i + K > N:
    break
  if A[i]*A[i+K] <= 0:
    if abs[i] < abs[i+K]:
      ans = min(ans, abs[i]*2+abs[i+K])
    else:
      ans = min(ans, abs[i]+abs[i+K]*2)
print(ans)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 10**9
for i in range(N-K+1):
  if A[i]*A[i+K-1] <= 0:
    if abs(A[i]) < abs(A[i+K-1]):
      ans = min(ans, (abs(A[i]))*2+A[i+K-1])
    else:
      ans = min(ans, abs(A[i])+A[i+K-1]*2)
  else:
    if abs(A[i]) < abs(A[i+K-1]):
      ans = min(ans, abs(A[i+K-1]))
    else:
      ans = min(ans, abs(A[i]))
print(ans)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
zero_idx = 0
for idx in range(N):
    if A[idx] > 0:
        zero_idx = idx
        break
if zero_idx == 0 and A[0] < 0:
  print(A[N-K])
elif zero_idx == 0 and A[0] > 0:
  print(A[K-1])
else 
  ans = 3*10**5
  for plus in range(N-zero_idx+1):
    if plus > K:
        break
    minus = K - plus
    if minus > zero_idx:
    	continue
    p_dis = A[zero_idx+plus-1]
    if plus == 0:
        p_dis = 0
    m_dis = A[zero_idx-minus]
    if minus == 0:
        m_dis = 0
    if p_dis >= abs(m_dis):
        ans = min(ans, p_dis+abs(m_dis)*2)
    else:
        ans = min(ans, abs(m_dis)+p_dis*2)
  print(ans)


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 10**9
for i in range(N-K+1):
  if A[i]*A[i+K-1] <= 0:
    if abs(A[i]) < abs(A[i+K-1]):
      ans = min(ans, (abs(A[i]))*2+A[i+K-1])
    else:
      ans = min(ans, abs(A[i])+A[i+K-1]*2)
  else:
    if abs(A[i]) < abs(A[i+K-1]):
      ans = min(ans, abs(A[i+K-1]))
    else:
      ans = min(ans, abs(A[i]))
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
if S[0] != '1':
  print(S[0])
else:
  ans = '1'
  for i in range(K+1)[1:]:
    if S[i] != '1':
      ans = S[i]
      break
  print(ans)


Fixed submission:
S = input()
K = int(input())
if S[0] != '1':
  print(S[0])
else:
  ans = '1'
  for i in range(K)[1:]:
    if S[i] != '1':
      ans = S[i]
      break
  print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
if S[0] != '1':
  print(S[0])
else:
  for i in range(len(S)[1:]):
    if i >= K:
      print(1)
      break
    if S[i] != 1:
      print(S[i])
      break

Fixed submission:
S = input()
K = int(input())
if S[0] != '1':
  print(S[0])
else:
  ans = '1'
  for i in range(K)[1:]:
    if S[i] != '1':
      ans = S[i]
      break
  print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
A = S
if S == T:
  print('Yes')
else:
  eq = False:
  for i in range(len(S)):
    A = A[-1] + A[0:-1]
    if A == T:
      eq = True
      break
  if eq:
    print('Yes')
  else:
    print('No')
  

Fixed submission:
S = input()
T = input()
A = S
if S == T:
  print('Yes')
else:
  eq = False
  for i in range(len(S)):
    A = A[-1] + A[0:-1]
    if A == T:
      eq = True
      break
  if eq:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
ans = 0
for i in range(N):
  ans += A[i]-1
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
  ans += A[i]-1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
sum_digit = 0
for i in range(len(N)):
  sum_digit += int(N[i])
if N%sum_digit == 0:
  print('Yes')
else:
  print('No')


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

Buggy python submission (verdict: Runtime Error):
N = input()
sum_digit = 0
for i in range(len(N)):
  sum_digit += N[i]
if N%sum_digit == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
N = input()
sum_digit = 0
for i in range(len(N)):
  sum_digit += int(N[i])
if int(N)%sum_digit == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

min_idx = 0
for idx in range(N):
  if A[idx] < A[min_idx]:
    min_idx = idx
ans = 10**5
for idx in range(K):
  left = min_idx - K + idx
  right = min_idx + idx
  if min_idx - K + idx < 0:
    continue
  if min_idx - K + idx >= N:
    break
  sum_cnt = 1
  if (N-right)%(K-1) == 0:
    sum_cnt += (N-right)//(K-1)
  else:
    sum_cnt += (N-mright)//(K-1)+1
  if left%(K-1) == 0:
    sum_cnt += left//(K-1)
  else:
    sum_cnt += left//(K-1) + 1
  ans = min(ans, sum_cnt)
print(ans)


Fixed submission:
import math

N, K = map(int, input().split())
nums = list(map(int, input().split()))
print(math.ceil((len(nums)-1)/(K-1)))

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

min_idx = 0
for idx in range(N):
  if A[idx] < A[min_idx]:
    min_idx = idx
ans = 0
if (N-min_idx)%(K-1) == 0:
  ans += (N-min_idx)//(K-1)
else:
  ans += (N-min_idx)//(K-1)+1
if min_idx%(K-1) == 0:
  ans += min_idx//(K-1)
else:
  ans += min_idx//(K-1) + 1
print(ans)


Fixed submission:
import math

N, K = map(int, input().split())
nums = list(map(int, input().split()))
print(math.ceil((len(nums)-1)/(K-1)))

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

min_idx = 10**5
for idx in range(N):
  if A[idx] < A[min_idx]:
    min_idx = idx
ans = 0
if (N-idx)%(K-1) == 0:
  ans += (N-idx)//(K-1)
else:
  ans += (N-idx)//(K-1)+1
if idx%(K-1) == 0:
  ans += idx//(K-1)
else:
  ans += idx//(K-1) + 1
print(ans)


Fixed submission:
import math

N, K = map(int, input().split())
nums = list(map(int, input().split()))
print(math.ceil((len(nums)-1)/(K-1)))

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

A = 10**5
min_idx = 0
for idx in range(N):
  if A[idx] < A[min_idx]:
    min_idx = idx
ans = 0
if (N-idx)%(K-1) == 0:
  ans += (N-idx)//(K-1)
else:
  ans += (N-idx)//(K-1)+1
if idx%(K-1) == 0:
  ans += idx//(K-1)
else:
  ans += idx//(K-1) + 1
print(ans)


Fixed submission:
import math

N, K = map(int, input().split())
nums = list(map(int, input().split()))
print(math.ceil((len(nums)-1)/(K-1)))
Buggy python submission (verdict: Runtime Error):
D, N = map(int, input().split())
if D == 0:
  if N == 100:
    print(101)
  else:
  	print(N)
elif D == 1:
  if N == 10000:
    print(10100)
  else:
    print(N*100)
else:
  if N == 100
    print(1000100)
  else:
    print(N*10000)


Fixed submission:
D, N = map(int, input().split())
if D == 0:
  if N == 100:
    print(101)
  else:
  	print(N)
elif D == 1:
  if N == 100:
    print(10100)
  else:
    print(N*100)
else:
  if N == 100:
    print(1010000)
  else:
    print(N*10000)

Buggy python submission (verdict: Runtime Error):
D, N = map(int, input().split())
if D == 0:
  if N == 100:
    print(101)
  else:
  	print(N)
elif D == 1:
  if N == 10000:
    print(10100)
  else:
  	print(N*100)
else:
  if N == 100
    print(1000100)
  else:
    print(N*10000)


Fixed submission:
D, N = map(int, input().split())
if D == 0:
  if N == 100:
    print(101)
  else:
  	print(N)
elif D == 1:
  if N == 100:
    print(10100)
  else:
    print(N*100)
else:
  if N == 100:
    print(1010000)
  else:
    print(N*10000)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

sum_div = 0
for i in range(N):
  temp_div = A[i]
  while True:
    if temp_div%2 == 0:
      sum_div += 1
      temp_div = A[i]//2
    else:
      break
print(sum_div)

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

sum_div = 0
for i in range(N):
  temp_div = A[i]
  while True:
    if temp_div%2 == 0:
      sum_div += 1
      temp_div = temp_div//2
    else:
      break
print(sum_div)
Buggy python submission (verdict: Runtime Error):
N = int(input())
INF = 10**6
dp = [INF] * (max(9, N))
for i in range(10):
  if  0 < i < 6:
    dp[i] = i
  elif i < 9:
    dp[i] = i%6+1
for i in range(N):
  n = m = 1
  while i+9**n <= N:
    dp[i+9**n] = min(dp[i+9**n], dp[i] + 1)
    n += 1
  while i+6**m <= N:
    dp[i+6**m] = min(dp[i+6**m], dp[i] + 1)
    m += 1
print(dp[N])


Fixed submission:
N = int(input())
if N >= 1000:
  print('ABD')
else:
  print('ABC')
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
h = (b-a)(b-a+1)//2
print(h-b)

Fixed submission:
a, b = map(int, input().split())
h = (b-a)*(b-a+1)//2
print(h-b)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
ans = 0
for i in range(1, N):
  left = [:i]
  right = [i:]
  cnt = 0
  both = []
  for j in range(len(right)):
    if right[j] in left and not right[j] in both:
      cnt += 1
      both.append(right[j])
  ans = max(ans, cnt)
print(ans)

Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(1, N):
  left = S[:i]
  right = S[i:]
  cnt = 0
  both = []
  for j in range(len(right)):
    if right[j] in left and not right[j] in both:
      cnt += 1
      both.append(right[j])
  ans = max(ans, cnt)
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C, K = map(int, input().split())
if K%2 = 0:
  print(A-B)
else:
  print(B-A)

Fixed submission:
A, B, C, K = map(int, input().split())
if K%2 == 0:
  print(A-B)
else:
  print(B-A)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
if abs(c-a) <= d or (abs(c-b) <= d and dabs(b-a) <= d):
  print('Yes')
else:
  print('No')


Fixed submission:
a, b, c, d = map(int, input().split())
if abs(c-a) <= d or (abs(c-b) <= d and abs(b-a) <= d):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
num = 2
idx = 1
nums = [1]
while True:
  if num**idx > N:
    if idx == 2 or num ==1:
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])


Fixed submission:
N = int(input())
num = 2
idx = 1
nums = [1]
while True:
  if num**idx > N:
    if idx == 2 or N in range(1, 5):
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
num = 2
idx = 1
nums = [1]
while True:
  if num**idx > N:
    if idx == 2:
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])


Fixed submission:
N = int(input())
num = 2
idx = 1
nums = [1]
while True:
  if num**idx > N:
    if idx == 2 or N in range(1, 5):
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])

Buggy python submission (verdict: Runtime Error):
N = int(input())
num = 2
idx = 2
nums = []
while True:
  if num**idx > N:
    if idx == 2:
      break
    else:
      num += 1
      idx = 2
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])


Fixed submission:
N = int(input())
num = 2
idx = 1
nums = [1]
while True:
  if num**idx > N:
    if idx == 2 or N in range(1, 5):
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
num = 2
idx = 1
nums = []
while True:
  if num**idx > N:
    if idx == 2:
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])

Fixed submission:
N = int(input())
num = 2
idx = 1
nums = [1]
while True:
  if num**idx > N:
    if idx == 2 or N in range(1, 5):
      break
    else:
      num += 1
      idx = 0
      continue
  else:
    nums.append(num**idx)
    idx += 1
nums.sort(key=lambda x:-x)
print(nums[0])
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
K = int(input())
print(sum(a, b, c) + max(a, b, c)*K)


Fixed submission:
nums = list(map(int, input().split()))
K = int(input())
print(sum(nums) + max(nums)*(2**K) - max(nums))

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
K = int(input())
print(sum(a, b, c) + max(a, b, c)*(K-1))

Fixed submission:
nums = list(map(int, input().split()))
K = int(input())
print(sum(nums) + max(nums)*(2**K) - max(nums))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
campus = [list(map(int, input().split())) for _ in range(H)]
ans = [[0] * (W) for _ in range(H)]

for i in range(H):
  before = ''
  for j in range(W):
    if campus[i][j] == before and campus[i][j] == '#':
      ans[il[j-1], ans[i][j] = 0, 0
    elif campus[i][j] == '#':
      ans[i][j] = 1
    before = campus[i][j]
for j in range(W):
  before = ''
  for i in range(H):
    if campus[i][j] == before and campus[i][j] == '#':
      ans[i-1][j], ans[i][j] = 0, 0
    elif campus[i][j] == '#':
      ans[i][j] = 1
    before = campus[i][j]
finish = 'Yes'
for i in range(H):
  for j in range(W):
    if ans[i][j] == 1:
      finish = 'No'
      break
   else:
     continue
   break
prin(finish)
  
      

Fixed submission:
H, W = map(int, input().split())
campus = [['.' for _ in range(W+2)]]
for _ in range(H):
    campus.append(['.'] + list(input()) + ['.'])
campus.append(['.' for _ in range(W+2)])

finish = True
for i in range(1, H+1):
    for j in range(1, W+1):
        if campus[i][j] == '#':
            if campus[i-1][j] != '#' and campus[i][j+1] != '#' and campus[i+1][j] != '#' and campus[i][j-1] != '#':
                finish = False
                break
    else:
        continue
    break
if finish:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
tolls = list(map(int, input().split()))
gate_l = 0
for toll in tools:
  if toll > X:
    break
  gate_l += 1
print(min(gate_l, M-gate_l))


Fixed submission:
N, M, X = map(int, input().split())
tolls = list(map(int, input().split()))
gate_l = 0
for toll in tolls:
  if toll > X:
    break
  gate_l += 1
print(min(gate_l, M-gate_l))
Buggy python submission (verdict: Runtime Error):
S = int(input())
if S[0] == S[1] or S[1] == S[2] or S[2] == S[0]:
  print('No')
else:
  print('Yes')

Fixed submission:
S = input()
if S[0] == S[1] or S[1] == S[2] or S[2] == S[0]:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

nums = []
for num in range(A, min(A+K, B+1)):
  nums.append(num)
for num in range(min(B-K+1, a), B+1):
  if not num in nums:
    nums.append(num)
nums.sort()
for num in nums:
  print(num)

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

nums = []
for num in range(A, min(A+K, B+1)):
  nums.append(num)
for num in range(max(B-K+1, A), B+1):
  if not num in nums:
    nums.append(num)
nums.sort()
for num in nums:
  print(num)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
num = A
while num <= B:
  if num <= A+K-1 or num >= B-K+1:
    print(num)
  num += 1
    


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

nums = []
for num in range(A, min(A+K, B+1)):
  nums.append(num)
for num in range(max(B-K+1, A), B+1):
  if not num in nums:
    nums.append(num)
nums.sort()
for num in nums:
  print(num)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
for num in range(A, B+1):
  if num <= A+K-1 or num >= B-K+1:
    print(num)
    


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

nums = []
for num in range(A, min(A+K, B+1)):
  nums.append(num)
for num in range(max(B-K+1, A), B+1):
  if not num in nums:
    nums.append(num)
nums.sort()
for num in nums:
  print(num)
Buggy python submission (verdict: Runtime Error):
N = int(input())
arares = list(map(int, input().split()))
four = False
for arare in arares:
  if arare == 'Y':
    four = True
    break
if four:
  print('Four')
else:
  print('Three')

Fixed submission:
N = int(input())
arares = list(input().split())
four = False
for arare in arares:
  if arare == 'Y':
    four = True
    break
if four:
  print('Four')
else:
  print('Three')
Buggy python submission (verdict: Runtime Error):
N = int(input())
names_dic = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}
FIRST = ('M', 'A', 'R', 'C', 'H')
for _ in range(N):
  nams = input()
  if name[0] in FIRST:
    names_dic[name[0]] += 1
ans = 0
for i in range(5):
  for j in range(i+1, 5):
    for k in range(j+1, 5):
      ans += names_dic[FIRST[i]]*names_dic[FIRST[j]]*names_dic[FIRST[k]]
print(ans)

Fixed submission:
N = int(input())
names = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}
FIRST = ('M', 'A', 'R', 'C', 'H')
for _ in range(N):
  name = input()
  if name[0] in FIRST:
    names[name[0]] += 1
ans = 0
for i in range(5):
  for j in range(i+1, 5):
    for k in range(j+1, 5):
      ans += names[FIRST[i]]*names[FIRST[j]]*names[FIRST[k]]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
first = int(S[0])
if first == 0:
  print((len(N)-1)*9)
else:
  print(first-1+(len(N)-1)*9)

Fixed submission:
N = input()

def rest_nine(x):
  for i in range(1, len(x)):
    if int(x[i]) != 9:
      return False
  return True

if rest_nine(N):
  print(int(N[0])+(len(N)-1)*9)
else:
  print(int(N[0])-1+(len(N)-1)*9)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [[0] + list(map(int, input())) + [0] for _ in range(2)]

R1 = [0] * (N+1)
R2 = [0] * (N+2)

for i in range(1, N+1):
  R1[i] = R[i-1]+A[0][i]
  R2[i] = R[i+1]+A[1][i]

ans = 0
for i in range(1, N+1):
  ans = max(ans, R1[i]+R2[i])
print(ans)

Fixed submission:
N = int(input())
A = [[0] + list(map(int, input().split())) + [0] for _ in range(2)]

R1 = [0] * (N+1)
R2 = [0] * (N+2)

for i in range(1, N+1):
  R1[i] = R1[i-1]+A[0][i]
  R2[N-i+1] = R2[N-i+2]+A[1][N-i+1]

ans = 0
for i in range(1, N+1):
  ans = max(ans, R1[i]+R2[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
candies = [list(map(int, input().split())) for _ in range(2)]
dp = [[0,0] for _ in range(N)]
dp[0][0] = candies[0][0]
dp[1][0] = dp[0][0] + candies[1][0]
for i in range(1, N):
  dp[0][i] += dp[0][i-1] + candies[0][i]
  dp[1][i] = max(dp[0][i], dp[1][i-1]) + candies[1][i]
print(dp[1][N-1])

Fixed submission:
N = int(input())
candies = [list(map(int, input().split())) for _ in range(2)]
dp = [[0] * (N) for _ in range(2)]
dp[0][0] = candies[0][0]
dp[1][0] = dp[0][0] + candies[1][0]
for i in range(1, N):
  dp[0][i] = dp[0][i-1] + candies[0][i]
  dp[1][i] = max(dp[0][i], dp[1][i-1]) + candies[1][i]
print(dp[1][N-1])