Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
dp = {100: 1, 101: 1, 102: 1, 103: 1, 104: 1, 105: 1}
l = [100, 101, 102, 103, 104, 105]
for i in range(100001):
  if i == 0:
    dp[0] = 1
  elif i < 100:
    dp[i] = 0
  elif i >= 106:
    for cost in l:
      dp[i] += dp[i-cost]

n = int(input())
if dp[n] >= 1:
  print(1)
else:
  print(0)
    

Fixed submission:
dp = {100: 1, 101: 1, 102: 1, 103: 1, 104: 1, 105: 1}
l = [100, 101, 102, 103, 104, 105]
for i in range(100001):
  if i == 0:
    dp[0] = 1
  elif i < 100:
    dp[i] = 0
  elif i >= 106:
    dp[i] = 0
    for cost in l:
      dp[i] += dp[i-cost]

n = int(input())
if dp[n] >= 1:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

before = [[-1] * 10]

for i in range(n):
  c = s[i]
  num = int(c)
  hoge = before[-1][::]
  hoge[num] = i
  before.append(hoge)

for i in range(10):
  now = before[-1][i]
  if now == -1:
    continue
  for j in range(10):
    now2 = before[now][j]
    if now2 == -1:
      continue
    for k in range(10):
      now3 = before[now2][k]
      if now3 == -1:
        continue
      ans += 1
print(ans)

Fixed submission:
n = int(input())
s = input()

before = [[-1] * 10]

for i in range(n):
  c = s[i]
  num = int(c)
  hoge = before[-1][::]
  hoge[num] = i
  before.append(hoge)
ans = 0
for i in range(10):
  now = before[-1][i]
  if now == -1:
    continue
  for j in range(10):
    now2 = before[now][j]
    if now2 == -1:
      continue
    for k in range(10):
      now3 = before[now2][k]
      if now3 == -1:
        continue
      ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
def color(A, dic):
  if len(A) == 0:
    return 1
  t = A.pop()
  dic[t] -= 1
  return ((3-dic[t])*color(A, dic)) % (10**9 + 7)

n = int(input())
A = list(map(int, input().split()))
dic = {}
for i in range(n):
  if A[i] in dic:
    dic[A[i]] += 1
  else:
    dic[A[i]] = 1
print(color(A, dic))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
que = [-1, -1, -1]
ans = 1
for i in range(n):
  if que[0]+1 == a[i]:
    if que[0] == que[1] and que[0] == que[2]:
      ans *= 3
      ans %= (10**9 + 7)
    elif que[0] == que[1]:
      ans *= 2
      ans %= (10**9 + 7)
    que[0] = a[i]
  elif que[1]+1 == a[i]:
    if que[1] == que[2]:
      ans *= 2
      ans %= (10**9 + 7)
    que[1] = a[i]
  elif que[2]+1 == a[i]:
    que[2] = a[i]
  else:
    ans = 0
    break
print(ans)

Buggy python submission (verdict: Runtime Error):
def color(A, dic):
  if len(A) == 0:
    return 1
  t = A.pop()
  dic[t] -= 1
  return (3-dic[t])*color(A, dic)

n = int(input())
A = list(map(int, input().split()))
dic = {}
for i in range(n):
  if A[i] in dic:
    dic[A[i]] += 1
  else:
    dic[A[i]] = 1
print(color(A, dic))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
que = [-1, -1, -1]
ans = 1
for i in range(n):
  if que[0]+1 == a[i]:
    if que[0] == que[1] and que[0] == que[2]:
      ans *= 3
      ans %= (10**9 + 7)
    elif que[0] == que[1]:
      ans *= 2
      ans %= (10**9 + 7)
    que[0] = a[i]
  elif que[1]+1 == a[i]:
    if que[1] == que[2]:
      ans *= 2
      ans %= (10**9 + 7)
    que[1] = a[i]
  elif que[2]+1 == a[i]:
    que[2] = a[i]
  else:
    ans = 0
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
<_cnt = 0
>_cnt = 0
total = 0
for i in range(len(s)):
  if s[i] == '<' and >_cnt == 0:
    <_cnt += 1
  elif s[i] == '<' and >_cnt > 0:
    k = max(<_cnt, >_cnt)
    l = min(<_cnt, >_cnt)
    total += (((k+1)*k) + (l*(l-1)))//2
    <_cnt = 1
    >_cnt = 0
  elif s[i] == '>':
    >_cnt += 1
k = max(<_cnt, >_cnt)
l = min(<_cnt, >_cnt)
total += (((k+1)*k) + (l*(l-1)))//2
print(total)

Fixed submission:
s = input()
right_cnt = 0
left_cnt = 0
total = 0
for i in range(len(s)):
  if s[i] == '<' and left_cnt == 0:
    right_cnt += 1
  elif s[i] == '<' and left_cnt > 0:
    k = max(right_cnt, left_cnt)
    l = min(right_cnt, left_cnt)
    total += (((k+1)*k) + (l*(l-1)))//2
    right_cnt = 1
    left_cnt = 0
  elif s[i] == '>':
    left_cnt += 1
k = max(right_cnt, left_cnt)
l = min(right_cnt, left_cnt)
total += (((k+1)*k) + (l*(l-1)))//2
print(total)

Buggy python submission (verdict: Runtime Error):
s = input()
<_cnt = 0
>_cnt = 0
total = 0
for i in range(len(s)):
  if s[i] == '<' and >_cnt == 0:
    <_cnt += 1
  elif s[i] == '<' and >_cnt > 0:
    k = max(<_cnt, >_cnt)
    l = min(<_cnt, >_cnt)
    total += (k+1)*k//2 + l*(l-1)//2
    <_cnt = 1
    >_cnt = 0
  elif s[i] == '>':
    >_cnt += 1
k = max(<_cnt, >_cnt)
l = min(<_cnt, >_cnt)
total += (k+1)*k//2 + l*(l-1)//2
print(total)
    


Fixed submission:
s = input()
right_cnt = 0
left_cnt = 0
total = 0
for i in range(len(s)):
  if s[i] == '<' and left_cnt == 0:
    right_cnt += 1
  elif s[i] == '<' and left_cnt > 0:
    k = max(right_cnt, left_cnt)
    l = min(right_cnt, left_cnt)
    total += (((k+1)*k) + (l*(l-1)))//2
    right_cnt = 1
    left_cnt = 0
  elif s[i] == '>':
    left_cnt += 1
k = max(right_cnt, left_cnt)
l = min(right_cnt, left_cnt)
total += (((k+1)*k) + (l*(l-1)))//2
print(total)

Buggy python submission (verdict: Runtime Error):
s = input()
<_cnt = 0
>_cnt = 0
for i in range(len(s)):
  if s[i] == '<' and >_cnt == 0:
    <_cnt += 1
  elif s[i] == '<' and >_cnt > 0:
    k = max(<_cnt, >_cnt)
    l = min(<_cnt, >_cnt)
    total += (k+1)*k//2 + l*(l-1)//2
    <_cnt = 1
    >_cnt = 0
  elif s[i] == '>':
    >_cnt += 1
k = max(<_cnt, >_cnt)
l = min(<_cnt, >_cnt)
total += (k+1)*k//2 + l*(l-1)//2
print(total)
    

Fixed submission:
s = input()
right_cnt = 0
left_cnt = 0
total = 0
for i in range(len(s)):
  if s[i] == '<' and left_cnt == 0:
    right_cnt += 1
  elif s[i] == '<' and left_cnt > 0:
    k = max(right_cnt, left_cnt)
    l = min(right_cnt, left_cnt)
    total += (((k+1)*k) + (l*(l-1)))//2
    right_cnt = 1
    left_cnt = 0
  elif s[i] == '>':
    left_cnt += 1
k = max(right_cnt, left_cnt)
l = min(right_cnt, left_cnt)
total += (((k+1)*k) + (l*(l-1)))//2
print(total)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input())
if A <= 2*B:
  print(0)
else:
  print(A - 2*B)

Fixed submission:
A, B = map(int, input().split())
if A <= 2*B:
  print(0)
else:
  print(A - 2*B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
list = input().split(' ')
sq_list = []
for i in list:
  sq_list.append(i ** 2)
print((sum(list) ** 2 - sum(sq_list))//2)

Fixed submission:
N = int(input())
no_list = list(map(int, input().split()))
sq_list = []
for i in no_list:
  sq_list.append(i ** 2)
print((sum(no_list) ** 2 - sum(sq_list))//2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0
for i in range(1, N + 1):
  if S[i - 1] == S[i]:
    count += 1
print(N - count)

Fixed submission:
N = int(input())
S = input()
count = 0
for i in range(1, N):
  if S[i - 1] == S[i]:
    count += 1
print(N - count)
Buggy python submission (verdict: Runtime Error):
S = input()
dic = {'Sunny':'Cloud', 'Cloud':'Rainy', 'Rainy':'Sunny'}
print(dic[S])

Fixed submission:
S = input()
dic = {'Sunny':'Cloudy', 'Cloudy':'Rainy', 'Rainy':'Sunny'}
print(dic[S])
Buggy python submission (verdict: Runtime Error):
S = input()
ans = 'Yes'
for i in range((len(S) + 1) // 2):
  if S[2*i] == 'L' or S[2*i + 1] == 'R':
    ans = 'No'
    break

print(ans)


Fixed submission:
s = input()
n = len(s)
flg = True
for i in range(n):
  if i % 2 == 0 and s[i] == 'L':
    flg = False
    break
  elif i % 2 == 1 and s[i] == 'R':
    flg = False
    break

if flg:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
point = [0] * (n+1)
for _ in range(n):
  a = int(input())
  point[a] += 1

for i in range(1, n+1):
  if k + point[i] > q:
    print('Yes')
  else:
    print('No')

Fixed submission:
n, k, q = map(int, input().split())
point = [0] * (n+1)
for _ in range(q):
  a = int(input())
  point[a] += 1

for i in range(1, n+1):
  if k + point[i] > q:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
b_dic = {}
for i in range(1, N + 1):
  b_dic[i] = B[i - 1]
c_dic = {}
for i in range(1, N):
  c_dic[i] = C[i - 1]
count=0
br = -1
for a in A:
  count += B[a]
  if br == a - 1:
    count += C[br]
  br = a
print(count)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
b_dic = {}
for i in range(1, N + 1):
  b_dic[i] = B[i - 1]
c_dic = {}
for i in range(1, N):
  c_dic[i] = C[i - 1]
count=0
br = -1
for a in A:
  count += b_dic[a]
  if br == a - 1:
    count += c_dic[br]
  br = a
print(count)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
count = 0
for i in range(3):
  if s[i] == T[i]:
    count += 1
print(count)

Fixed submission:
S = input()
T = input()
count = 0
for i in range(3):
  if S[i] == T[i]:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s = input()
r_cnt = 0
l_cnt = 0
lst = [0 for _ in range(len(s))]
  s += 'R'
for i in range(len(s)-1):
  if s[i] == 'R' and l_cnt == 0:
    r_cnt += 1
  elif s[i] == 'L' and r_cnt > 0:
    l_cnt += 1
    if r_cnt % 2 == 0:
      lst[i] += r_cnt // 2
      lst[i-1] += r_cnt // 2
    else:
      lst[i] += r_cnt // 2
      lst[i-1] += r_cnt // 2 + 1
    r_cnt = 0
  elif s[i] == 'L' and r_cnt == 0:
    l_cnt += 1
  elif s[i] == 'R' and l_cnt > 0:
    r_cnt += 1
    if l_cnt % 2 == 0:
      lst[i-1] += l_cnt // 2
      lst[i-2] += l_cnt // 2
    else:
      lst[i-1] += l_cnt // 2 + 1
      lst[i-2] += l_cnt // 2
    l_cnt = 0
print(*lst)

Fixed submission:
s = input()
r_cnt = 0
l_cnt = 0
lst = [0 for _ in range(len(s))]
s += 'R'
for i in range(len(s)):
  if s[i] == 'R' and l_cnt == 0:
    r_cnt += 1
  elif s[i] == 'L' and r_cnt > 0:
    l_cnt += 1
    if r_cnt % 2 == 0:
      lst[i] += r_cnt // 2
      lst[i-1] += r_cnt // 2
    else:
      lst[i] += r_cnt // 2
      lst[i-1] += r_cnt // 2 + 1
    r_cnt = 0
    ind = i
  elif s[i] == 'L' and r_cnt == 0:
    l_cnt += 1
  elif s[i] == 'R' and l_cnt > 0:
    r_cnt += 1
    if l_cnt % 2 == 0:
      lst[ind] += l_cnt // 2
      lst[ind-1] += l_cnt // 2
    else:
      lst[ind] += l_cnt // 2 + 1
      lst[ind-1] += l_cnt // 2
    l_cnt = 0
print(*lst)

Buggy python submission (verdict: Runtime Error):
s = input()
r_cnt = 0
l_cnt = 0
lst = [0 for _ in range(len(s))]
  s += 'R'
for i in range(len(s)):
  if s[i] == 'R' and l_cnt == 0:
    r_cnt += 1
  elif s[i] == 'L' and r_cnt > 0:
    l_cnt += 1
    if r_cnt % 2 == 0:
      lst[i] += r_cnt // 2
      lst[i-1] += r_cnt // 2
    else:
      lst[i] += r_cnt // 2
      lst[i-1] += r_cnt // 2 + 1
    r_cnt = 0
  elif s[i] == 'L' and r_cnt == 0:
    l_cnt += 1
  elif s[i] == 'R' and l_cnt > 0:
    r_cnt += 1
    if l_cnt % 2 == 0:
      lst[i-1] += l_cnt // 2
      lst[i-2] += l_cnt // 2
    else:
      lst[i-1] += l_cnt // 2 + 1
      lst[i-2] += l_cnt // 2
    l_cnt = 0
print(*lst)


Fixed submission:
s = input()
r_cnt = 0
l_cnt = 0
lst = [0 for _ in range(len(s))]
s += 'R'
for i in range(len(s)):
  if s[i] == 'R' and l_cnt == 0:
    r_cnt += 1
  elif s[i] == 'L' and r_cnt > 0:
    l_cnt += 1
    if r_cnt % 2 == 0:
      lst[i] += r_cnt // 2
      lst[i-1] += r_cnt // 2
    else:
      lst[i] += r_cnt // 2
      lst[i-1] += r_cnt // 2 + 1
    r_cnt = 0
    ind = i
  elif s[i] == 'L' and r_cnt == 0:
    l_cnt += 1
  elif s[i] == 'R' and l_cnt > 0:
    r_cnt += 1
    if l_cnt % 2 == 0:
      lst[ind] += l_cnt // 2
      lst[ind-1] += l_cnt // 2
    else:
      lst[ind] += l_cnt // 2 + 1
      lst[ind-1] += l_cnt // 2
    l_cnt = 0
print(*lst)
Buggy python submission (verdict: Runtime Error):
n, d = map(int, input().split())
lst = []
for _ in range(n):
  x = list(map(int, input().split()))
ans = 0
for i in range(n-1):
  for j in range(i+1, n):
    dist = 0
    for k in range(d):
      dist += (lst[i][k] - lst[j][k])**2
    j = 1
    while j**2 <= dist:
      if j**2 == dist:
        ans += 1
        break
      j += 1
print(ans)

Fixed submission:
n, d = map(int, input().split())
lst = []
for _ in range(n):
  x = list(map(int, input().split()))
  lst.append(x)
ans = 0
for i in range(n-1):
  for j in range(i+1, n):
    dist = 0
    for k in range(d):
      dist += (lst[i][k] - lst[j][k])**2
    j = 1
    while j**2 <= dist:
      if j**2 == dist:
        ans += 1
        break
      j += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(N - 2):
  if min(p[i], p[i + 2]) < p[i + 1] < max(p[i], p[i + 2]):
    count += 1
print(count)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n - 2):
  if min(p[i], p[i + 2]) < p[i + 1] < max(p[i], p[i + 2]):
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
for i in range(N):
  l.append(abs(L + i))
l.sort()
l.pop(0)
print(sum(l))

Fixed submission:
N, L = map(int, input().split())
l = []
for i in range(N):
  l.append(L + i)
l.sort()
if 0 in l:
  print(sum(l))
else:
  if l[0] > 0:
    l.pop(0)
    print(sum(l))
  else:
    l.pop(-1)
    print(sum(l))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = [True] * n
for _ in range(m):
  a = int(input())
  A[a] = False

mod = 10**9 + 7
dp = [0] * (n + 1)
dp[0] = 1
if A[1]:
  dp[1] = 1

for i in range(2, n+1):
  if A[i]:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[n])

  


Fixed submission:
n, m = map(int, input().split())
A = [True] * (n+1)
for _ in range(m):
  a = int(input())
  A[a] = False

mod = 10**9 + 7
dp = [0] * (n+1)
dp[0] = 1
if A[1]:
  dp[1] = 1

for i in range(2, n+1):
  if A[i]:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[n])

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = [True] * n
for _ in range(m):
  a = int(input())
  A[a] = False

mod = 10**9 + 7
dp = [0] * (n + 1)
dp[0] = 1
if 1 not in A:
  dp[1] = 1

for i in range(2, n+1):
  if A[i]:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[n])

  


Fixed submission:
n, m = map(int, input().split())
A = [True] * (n+1)
for _ in range(m):
  a = int(input())
  A[a] = False

mod = 10**9 + 7
dp = [0] * (n+1)
dp[0] = 1
if A[1]:
  dp[1] = 1

for i in range(2, n+1):
  if A[i]:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[n])

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
A = []
for _ in range(m):
  a = int(input())
  A.append(a)

mod = 10**9 + 7
dp = [0] * (n + 1)
dp[0] = 1
if 1 not in A:
  dp[1] = 1

for i in range(2, n+1):
  if i not in A:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[n])

  


Fixed submission:
n, m = map(int, input().split())
A = [True] * (n+1)
for _ in range(m):
  a = int(input())
  A[a] = False

mod = 10**9 + 7
dp = [0] * (n+1)
dp[0] = 1
if A[1]:
  dp[1] = 1

for i in range(2, n+1):
  if A[i]:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[n])
Buggy python submission (verdict: Runtime Error):
n = int(input())
lst = []
for i in range(n):
  s, p = input().split()
  p = int(p)
  lst.append((s, p, i+1))
lst_sorted = sorted(lst, key:lambda x: (x[0], -x[1], x[2]))
for _, _, num in lst_sorted:
  print(num)


Fixed submission:
n = int(input())
lst = []
for i in range(n):
  s, p = input().split()
  p = int(p)
  lst.append((s, p, i+1))
lst_sorted = sorted(lst, key=lambda x: (x[0], -x[1], x[2]))
for _, _, num in lst_sorted:
  print(num)

Buggy python submission (verdict: Runtime Error):
n = int(input())
lst = []
for i in range(n):
  s, p = input().split()
  p = int(p)
  lst.append((s, p, i+1))
lst_sorted = sorted(lst, key:lambda x: (x[0], -x[1]))
for _, _, num in lst_sorted:
  print(num)

Fixed submission:
n = int(input())
lst = []
for i in range(n):
  s, p = input().split()
  p = int(p)
  lst.append((s, p, i+1))
lst_sorted = sorted(lst, key=lambda x: (x[0], -x[1], x[2]))
for _, _, num in lst_sorted:
  print(num)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
v = list(map(int, input().split()))
reverse_v = v[::-1]
lst = [0] * (k + 1)
left = [[]]
right = [[]]
for i in range(1, n+1):
  left.append(v[:i])
  right.append(reverse_v[:i])

for cnt in range(1, k+1):
  rest = k - cnt
  total = 0
  for j in range(cnt+1):
    lst_j = left[j] + right[cnt-j]
    lst_j.sort()
    l = cnt
    for idx in range(cnt):
      if lst_j[idx] >= 0:
        l = idx
        break
    if l == cnt:
      value = 0
    else:
      flg = min(l, rest)
      value = sum(lst_j[flg:])
    if value > total:
      total = value
  lst[cnt] = total

ans = max(lst)
print(ans)

Fixed submission:
n, k = map(int, input().split())
v = list(map(int, input().split()))
reverse_v = v[::-1]
lst = [0] * (k + 1)
left = [[]]
right = [[]]
for i in range(1, n+1):
  left.append(v[:i])
  right.append(reverse_v[:i])

for cnt in range(1, k+1):
  rest = k - cnt
  total = 0
  if cnt <= n:
    for j in range(cnt+1):
      lst_j = left[j] + right[cnt-j]
      lst_j.sort()
      l = cnt
      for idx in range(cnt):
        if lst_j[idx] >= 0:
          l = idx
          break
      if l == cnt:
        value = 0
      else:
        flg = min(l, rest)
        value = sum(lst_j[flg:])
      if value > total:
        total = value
    lst[cnt] = total

ans = max(lst)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
for i in range(N):
  if i + 1 == K:
    S[i] = S[i].lower()
  else:
    S[i] = S[i]
print(S)

Fixed submission:
N, K = map(int, input().split())
S = input()
ans = ''
for i in range(N):
  if i + 1 == K:
    ans += S[i].lower()
  else:
    ans += S[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
R = []
for i range(N):
  l = V[i] - C[i]
  R.append(l)
cost = 0
for r in R:
  if r > 0:
    cost += r
print(cost)
  


Fixed submission:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
R = []
for i in range(N):
  l = V[i] - C[i]
  R.append(l)
cost = 0
for r in R:
  if r > 0:
    cost += r
print(cost)

Buggy python submission (verdict: Runtime Error):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
R = []
for i range(N):
  R.append(V[i] - C[i])
cost = 0
for r in R:
  if r > 0:
    cost += r
print(cost)
  

Fixed submission:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
R = []
for i in range(N):
  l = V[i] - C[i]
  R.append(l)
cost = 0
for r in R:
  if r > 0:
    cost += r
print(cost)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
b_total = 0
w_total = 0
ans = 0
for i in range(n):
  if s[i] == '#':
    b_cnt += 1
  if s[i] == '.':
    w_cnt += 1
b_cnt = 0
w_cnt = 0
ans = 10**6
for i in range(n):
  if s[i] == '#':
    b_cnt += 1
  if s[i] == '.':
    w_cnt += 1
  cnt = b_cnt + (w_total - w_cnt)
  ans = min(ans, cnt)
print(ans)

Fixed submission:
n = int(input())
s = input()
b_total = 0
w_total = 0
ans = 0
for i in range(n):
  if s[i] == '#':
    b_total += 1
  if s[i] == '.':
    w_total += 1
if b_total == n:
  print(0)
else:
  b_cnt = 0
  w_cnt = 0
  ans = b_cnt + (w_total - w_cnt)
  for i in range(n):
    if s[i] == '#':
      b_cnt += 1
    if s[i] == '.':
      w_cnt += 1
    cnt = b_cnt + (w_total - w_cnt)
    ans = min(ans, cnt)
  print(ans)
Buggy python submission (verdict: Runtime Error):
m = 9
l = []
r = []
for i in range(5):
  a = int(input())
  if a % 10 != 0:
    m = 10 - a % 10
    b = a + a % 10
    l.append(b)
    r.append(m)
  else:
    l.append(a)
r.sort()
print(sum(l) - r[-1])
      

Fixed submission:
m = 9
l = []
r = []
for i in range(5):
  a = int(input())
  if a % 10 != 0:
    m = 10 - a % 10
    b = a + m
    l.append(b)
    r.append(m)
  else:
    l.append(a)
    r.append(0)
r.sort()
print(sum(l) - r[-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
red = 0
blue
for s in S:
  if s == 'R':
    red += 1
  if s == 'B':
    blue += 1
if red > blue:
  print('Yes')
else:
  print('No')

Fixed submission:
N = int(input())
S = input()
red = 0
blue = 0
for s in S:
  if s == 'R':
    red += 1
  if s == 'B':
    blue += 1
if red > blue:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
S = input()
count = 0
l = []
for s in S:
  if s not in ['A', 'T', 'C', 'G']:
    l.append(count)
    count = 0
  else:
    count += 1
l.sort()
print(l[-1])

Fixed submission:
S = input()
S += 'Z'
count = 0
l = []
for s in S:
  if s not in ['A', 'T', 'C', 'G']:
    l.append(count)
    count = 0
  else:
    count += 1
l.sort()
print(l[-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 0
m = abs(A - T + h[0] * 0.006)
for i in range(N):
  d = T - h[i] * 0.006
  a = abs(A - d)
  if m >= a:
    m = a
    ans = i
print(ans)

Fixed submission:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 0
m = abs(A - T + H[0] * 0.006)
for i in range(N):
  d = T - H[i] * 0.006
  a = abs(A - d)
  if m >= a:
    m = a
    ans = i + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
C = []
for i in range(N):
  c, t = map(int, input().split())
  if t <= T:
    C.append(c)
C.sort()
print(C[0])

Fixed submission:
N, T = map(int, input().split())
C = []
for i in range(N):
  c, t = map(int, input().split())
  if t <= T:
    C.append(c)
if len(C) >= 1:
  C.sort()
  print(C[0])
else:
  print('TLE')
Buggy python submission (verdict: Runtime Error):
N, i = map(input().split())
print(N - i + 1)

Fixed submission:
N, i = map(int, input().split())
print(N - i + 1)
Buggy python submission (verdict: Runtime Error):
S = input()
w = int(input())
s = ''
if w == 1:
  print(S)
else:
  for i in range((len(S) // w) + 1):
    s += S[i * w]
  print(s)


Fixed submission:
S = input()
w = int(input())
s = ''
if w == 1:
  print(S)
else:
  if len(S) % w == 0:
    for i in range(len(S) // w):
      s += S[i * w]
    print(s)
  else:
    for i in range((len(S) // w) + 1):
      s += S[i * w]
    print(s)

Buggy python submission (verdict: Runtime Error):
S = input()
w = int(input())
s = ''
if w == 1:
  print(S)
else:
  for i in range((len(S) // w) + 1):
    s += S[i * w]
print(s)


Fixed submission:
S = input()
w = int(input())
s = ''
if w == 1:
  print(S)
else:
  if len(S) % w == 0:
    for i in range(len(S) // w):
      s += S[i * w]
    print(s)
  else:
    for i in range((len(S) // w) + 1):
      s += S[i * w]
    print(s)

Buggy python submission (verdict: Runtime Error):
S = input()
w = int(input())
s = ''
for i in range((len(S) // w) + 1):
  s += S[i * w]
print(s)

Fixed submission:
S = input()
w = int(input())
s = ''
if w == 1:
  print(S)
else:
  if len(S) % w == 0:
    for i in range(len(S) // w):
      s += S[i * w]
    print(s)
  else:
    for i in range((len(S) // w) + 1):
      s += S[i * w]
    print(s)