Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

result = 1

for i in range(k):
    result *= a[k - i]

for i in range(k, n):
    before_result = result
    result /= a[i - k]
    result *= a[i]
    if before_result < result:
        print("Yes")
    else:
        print("No")


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

for i in range(k, n):
    if a[i - k] < a[i]:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

results = []
result = 1

for i in range(k):
    result *= a[k - i]

for i in range(k - 1, n):
    result /= a[i - k]
    result *= a[i]
    results.append(result)
for i in range(1, len(results)):
    if results[i - 1] < results[i]:
        print("Yes")
    else:
        print("No")


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

for i in range(k, n):
    if a[i - k] < a[i]:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
results = []
for i in range(k - 1, n):
    result = 1
    for j in range(k):
        result *= a[i - j]
    results.append(result)
for i in range(1, len(results)):
    if results[i - 1] < results[i]:
        print("Yes")
    else:
        print("No")


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

for i in range(k, n):
    if a[i - k] < a[i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n = list(input())
if int("".join(n)) % 1000 == 0:
    print("0")
else:
    print((10 - int(n[-3])) * 100)


Fixed submission:
n = int(input())
if n % 1000 == 0:
    print("0")
else:
    print(((n // 1000) + 1) * 1000 - n)

Buggy python submission (verdict: Runtime Error):
n = list(input())
if n % 1000 == 0:
    print("0")
else:
    print((10 - int(n[-3])) * 100)


Fixed submission:
n = int(input())
if n % 1000 == 0:
    print("0")
else:
    print(((n // 1000) + 1) * 1000 - n)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]
ans = []
count = collections.Counter(a)
for i in range(q):
  total = 0
  num = count[bc[i][0]]
  count[bc[i][0]] = 0
  count[bc[i][1]] += num
  for key, value in zip(count.keys(), count.values()):
    total += int(key) * int(value)
  ans.append(total)

for out in ans:
  print(out)

Fixed submission:
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]
ans_count = []
total = 0
for i in range(n):
  total += a[i]

count = collections.Counter(a)
for i in range(q):
  num = count[bc[i][0]]
  count[bc[i][0]] = 0
  count[bc[i][1]] += num
  total += (bc[i][1] - bc[i][0]) * num
  print(total)
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n != 0:
  n = list(map(int, input().split()))
  min_n = abs(x - min(n))
  max_n = max(n) - x
  ans = []
  for i in range(1, max(min_n, max_n) + 1):
    if n.count(x + i) == 0:
      ans.append(x + i)

    if n.count(x - i) == 0:
      ans.append(x - i)
    
    if ans != []:
      break

  print(min(ans))
else:
  print(x)

Fixed submission:
x, n = map(int, input().split())
if n != 0:
  n = list(map(int, input().split()))
  ans = []
  for i in range(101):
    if n.count(x + i) == 0:
      ans.append(x + i)

    if n.count(x - i) == 0:
      ans.append(x - i)
    
    if ans != []:
      break

  print(min(ans))
else:
  print(x)

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n != 0:
  n = list(map(int, input().split()))
  min_n = min(n)
  max_n = max(n)
  ans = []
  for i in range(1, max(x - min_n, max_n - x) + 1):
    if n.count(x + i) == 0:
      ans.append(x + i)

    if n.count(x - i) == 0:
      ans.append(x - i)
    
    if ans != []:
      break

  print(min(ans))
else:
  print(x)

Fixed submission:
x, n = map(int, input().split())
if n != 0:
  n = list(map(int, input().split()))
  ans = []
  for i in range(101):
    if n.count(x + i) == 0:
      ans.append(x + i)

    if n.count(x - i) == 0:
      ans.append(x - i)
    
    if ans != []:
      break

  print(min(ans))
else:
  print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
  ans *= i
if not ans > (10 ** 18):
  print(ans)
else:
  print(-1)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if a.count(0) > 0:
  ans = 0
else:
  ans = 1

for i in a:
  ans *= i
  if ans > (10 ** 18):
    break

if not ans > (10 ** 18):
  print(ans)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n, m= map(int, (input().split()))
a = list(map(int, input().split()))
count = 0
total = 0
for i in a:
  total += i
for j in a:
  if j / total => 1 / (4 * m):
    count += 1
if count >= m:
  print("Yes")
else:
  print("No")

Fixed submission:
n, m= map(int, (input().split()))
a = list(map(int, input().split()))
count = 0
total = 0
for i in a:
  total += i
for j in a:
  if not (j / total < 1 / (4 * m)):
    count += 1
if count >= m:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
nk_abs = abs(n - k)
if n < nk_abs and n < k:
  print(n)
  exit()
if k == 1:
  print(0)
else:
  print(n % nk_abs)

Fixed submission:
n, k = map(int, input().split())
print(min(n % k, k - n % k))

Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
nk_abs = abs(n - k)
if n < nk_abs and n < k:
  print(n)
if k == 1:
  print(0)
else:
  print(n % nk_abs)

Fixed submission:
n, k = map(int, input().split())
print(min(n % k, k - n % k))

Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
nk_abs = abs(n - k)
if k == 1:
  print(0)
else:
  print(n % nk_abs)

Fixed submission:
n, k = map(int, input().split())
print(min(n % k, k - n % k))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
while(True):
  nk_abs = abs(n - k)

  if n <= k and n <= nk_abs:
    break
  if k == 1:
    n = 0
    break
  n = nk_abs

print(n)

Fixed submission:
n, k = map(int, input().split())
print(min(n % k, k - n % k))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
count = 0
while(True):
  nk_abs = abs(n - k)

  if min(n, k, nk_abs) == n:
    break
  if k == 1:
    n = 0
    break
  n = nk_abs
  count += 1

print(n)

Fixed submission:
n, k = map(int, input().split())
print(min(n % k, k - n % k))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
count = 0
while(True):
  nk_abs = abs(n - k)

  if min(n, k, nk_abs) == n:
    break
  n = nk_abs
  count += 1
  
print(n)

Fixed submission:
n, k = map(int, input().split())
print(min(n % k, k - n % k))
Buggy python submission (verdict: Runtime Error):
k, n = map(int, input().split())
a = list(map(int, input().split()))
distances = [0] * n
for i in range(n - 1):
  distances[i] = a[i] - a[i + 1]
distances[n] = k - a[n] + a[0]
print(k - max(distances))

Fixed submission:
k, n = map(int, input().split())
a = list(map(int, input().split()))
distances = [0] * n
for i in range(n - 1):
  distances[i] = a[i + 1] - a[i]
distances[n - 1] = k - a[n - 1] + a[0]
print(k - max(distances))
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
boad = h * w
if w == 1 and h == 1:
  print(1)
else:
  print((boad + 1) // 2)


Fixed submission:
k = int(input())
num_list = [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]
print(num_list[k -1])
Buggy python submission (verdict: Runtime Error):
a, b, m = map(int, input().split())
reizo = list(map(int, input().split()))
renji = list(map(int, input().split()))
p = [list(map(int,input().split())) for i in range(m)]
ans = []
for i in range(m):
  cost = reizo[p[i][0]] + renji[p[i][1]] - p[i][2]
  ans.append(cost)
ans.append(min(reizo) + min(renji))
print(min(ans))

Fixed submission:
a, b, m = map(int, input().split())
reizo = list(map(int, input().split()))
renji = list(map(int, input().split()))
p = [list(map(int,input().split())) for i in range(m)]
ans = []
for i in range(m):
  cost = reizo[p[i][0] - 1] + renji[p[i][1] - 1] - p[i][2]
  ans.append(cost)
ans.append(min(reizo) + min(renji))
print(min(ans))
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
q = n // (a + b)
mod = n % (a + b)
if mod <= a:
  print(a * q + mod)
else:
  print(a * q)

Fixed submission:
s = input()
if "A" in s and "B" in s:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
ans = ""
while True:
  ans += "b" * a
  ans += "r" * b
  if len(ans) >= n:
    break
print(ans[:n].count("b"))

Fixed submission:
n, a, b = map(int, input().split())
ans = n // (a+b) * a
mod = n % (a+b)
print(ans + min(a, mod))
Buggy python submission (verdict: Runtime Error):
a = []
[a.append(list(map(int, input().split()))) for _ in range(3)]
n = int(input())
b = [int(input())for _ in range(n)]
for i in b:
  for j in range(3):
    for k in range(3):
      if a[j][k] == i:
        a[j][k] = 1
ans = 0
count =0
for j in range(3):
  if a[j].count(1) == 3:
    ans += 1
  elif (a[0][j] == a[1][j] == a[2][j]) == 1:
    ans += 1
  elif (a[0][0] == a[1][1] == a[2][2]) == 1:
    ans += 1
  elif (a[0][2] == a[1][1] == a[2][0]) == 1:
    ans += 1
if ans > 0:
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
if N % 2 == 0:
  print( N // 2)
else:
  print( N // 2 + 1)

Buggy python submission (verdict: Runtime Error):
def cross_gugge(A):
  if A[0][0] == 1 and A[1][1] == 1 and A[2][2] == 1:
    ans += 1
  elif A[0][2] == 1 and A[1][1] == 1 and A[2][0] == 1:
    ans += 1
    
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
ans = 0
for i in range(3):
  for j in range(3):
    for k in B:
      if A[i][j] == k:
        A[i][j] = 1
for i in range(3):
  if A[i].count(1) == 3:
    ans += 1
  elif A[0][i] == 1 and A[1][i] == 1 and A[2][i] == 1:
    ans += 1
cross_gugge(A)
if ans > 0:
  print("Yes")
else:
  print("No")



Fixed submission:
N = int(input())
if N % 2 == 0:
  print( N // 2)
else:
  print( N // 2 + 1)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
s = [input() for _ in range(n)]
ans = []

charctor_count = Counter(s)
max_count = max(charctor_count.values())
for k, v in charctor_count.items():
  if v == max_count:
    ans.append( k)
print("\n".join(sorted(ans)))

Fixed submission:
a, b ,c = map(int,input().split())
if  a == b and b == c and a == c:
  print("No")
elif a == b or b == c or a == c:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
ans = {}

ans = Counter(s)
for k, v in sorted(ans.items()):
  if v == max(ans.values()):
    print(k)

Fixed submission:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
ans = []
charctor_count = Counter(s)
max_count = max(charctor_count.values())
for k, v in charctor_count.items():
  if v == max_count:
    ans.append( k)
print("\n".join(sorted(ans)))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n = int(input())
s = [input() for i in range(n)]
ans = {}
word_list = list(set(s))

for i in word_list:
  ans[i] = s.count(i)

for k, v in sorted(ans.items()):
  if v == max(ans.values()):
    print(k)

Fixed submission:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
ans = []
charctor_count = Counter(s)
max_count = max(charctor_count.values())
for k, v in charctor_count.items():
  if v == max_count:
    ans.append( k)
print("\n".join(sorted(ans)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
ans = {}
word_list = list(set(s))

for i in word_list:
  ans[i] = s.count(i)

for k, v in sorted(ans.items()):
  if v == max(ans.values()):
    print(k)

Fixed submission:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
ans = []
charctor_count = Counter(s)
max_count = max(charctor_count.values())
for k, v in charctor_count.items():
  if v == max_count:
    ans.append( k)
print("\n".join(sorted(ans)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
ans = []
out = []
word_list = list(set(s))

for i in word_list:
  ans.append([s.count(i), i])

ans.sort(reverse = True)

for j in ans:
  if j[0] == ans[0][0]:
    out.append(j[1])

out.sort()
for k in out:
  print(k)


Fixed submission:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
ans = []
charctor_count = Counter(s)
max_count = max(charctor_count.values())
for k, v in charctor_count.items():
  if v == max_count:
    ans.append( k)
print("\n".join(sorted(ans)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = [0] * (max(a)+1)
for i in range(n):
  ans[a[i]] += 1
ans.sort(reverse = True)
if ans[0] < 2:
  print("YES")
else:
  print("NO")


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
ans = max(Counter(a).values())
if ans < 2:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
h, n = map(int, input().split())
Deathblow = list(map(int, input().split()))
for i in n:
  h -= Deathblow[i]
if h < 1:
  print("Yes")
else:
  print("No")

Fixed submission:
h, n = map(int, input().split())
Deathblow = list(map(int, input().split()))
for i in range(n):
  h -= Deathblow[i]
if h < 1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import itertools

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

list_range = list(range(1,n+1))
pattern_list = list(itertools.permutations(list_range, n))
pattern_list.sort()
ans = [0] * 2
for i in range(len(pattern_list)):
  if p == list(pattern_list[i]):
    ans[0] = i + 1
  elif q == list(pattern_list[i]):
    ans[1] = i + 1
print(abs(ans[0] - ans[1]))

Fixed submission:
k, x = map(int,input().split())
if k * 500 >= x:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  if ans < 0:
    print('0 0')
  print('0 {}'.format(ans))
elif b == 0:
  print('0 {}'.format(a[1]))

elif b > 0:
  print('{} {}'.format(b, a[1]))

Fixed submission:
s, t = input().split(" ")
print(t+s)

Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  print('0 {}'.format(ans))
else:
  print('{} {}'.format(b, a[1]))


Fixed submission:
s, t = input().split(" ")
print(t+s)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  print('0 {}'.format(ans))
elif b == 0:
  print('0 {}'.format(a[1]))
elif ans < 0:
  print('0 0')
else:
  print('{} {}'.format(b, a[1]))

Fixed submission:
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  if ans < 0:
    print('0 0')
  else:
    print('0 {}'.format(ans))
elif b == 0:
  print('0 {}'.format(a[1]))

elif b > 0:
  print('{} {}'.format(b, a[1]))

Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = a[0] - a[2]
if b < 0:
  ans = a[1] + b
  print('0 {}'.format(ans))
elif ans < 0:
  print('0 0')
else:
  print('{} {}'.format(b, a[1]))


Fixed submission:
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  if ans < 0:
    print('0 0')
  else:
    print('0 {}'.format(ans))
elif b == 0:
  print('0 {}'.format(a[1]))

elif b > 0:
  print('{} {}'.format(b, a[1]))

Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  print('0 {}'.format(ans))
elif ans <= 0:
  print('0 0')
else:
  print('{} {}'.format(b, a[1]))


Fixed submission:
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  if ans < 0:
    print('0 0')
  else:
    print('0 {}'.format(ans))
elif b == 0:
  print('0 {}'.format(a[1]))

elif b > 0:
  print('{} {}'.format(b, a[1]))
Buggy python submission (verdict: Runtime Error):
スコード 

Copy
Copy
import math
def prime(n):
    for i in range(2, int(math.sqrt(n))):
        if n % i == 0: return False
    return True
 
X = int(input())
 
for i in range(X, 10**8):
    if prime(i):
        print(i)
        exit(0)
 
print('No prime number in this range')

Fixed submission:

import math
def prime(n):
    for i in range(2, int(math.sqrt(n))):
        if n % i == 0: return False
    return True
 
X = int(input())
 
for i in range(X, 10**8):
    if prime(i):
        print(i)
        exit(0)
 
print('No prime number in this range')

Buggy python submission (verdict: Runtime Error):

def get_primenumber(N):
    #素数リスト
    prime_list = [2]
    #3からNまでの数字を一つずつ取り出す
    for num in range(3,N+1,2):
      #取り出した数字が素数リストの要素で割れなければ素数リストに追加する
      if all( num % prime != 0 for prime in prime_list):
        prime_list.append(num)

    return prime_list

def main():
    prime = []
    ans = []
    number = int(input())
    prime = get_primenumber(50000)
    for i in range(number):
        if number <= prime[i]:
            ans.append(prime[i])
    print(min(ans))

if __name__ == "__main__":
    main()

Fixed submission:

import math
def prime(n):
    for i in range(2, int(math.sqrt(n))):
        if n % i == 0: return False
    return True
 
X = int(input())
 
for i in range(X, 10**8):
    if prime(i):
        print(i)
        exit(0)
 
print('No prime number in this range')

Buggy python submission (verdict: Runtime Error):

def get_primenumber(N):
    #素数リスト
    prime_list = [2]
    #3からNまでの数字を一つずつ取り出す
    for num in range(3,N+1,2):
      #取り出した数字が素数リストの要素で割れなければ素数リストに追加する
      if all( num % prime != 0 for prime in prime_list):
        prime_list.append(num)

    return prime_list

def main():
    prime = []
    ans = []
    number = int(input())
    prime = get_primenumber(50000)
    for i in range(number):
        if number < prime[i]:
            ans.append(prime[i])
            
    print(min(ans))

if __name__ == "__main__":
    main()

Fixed submission:

import math
def prime(n):
    for i in range(2, int(math.sqrt(n))):
        if n % i == 0: return False
    return True
 
X = int(input())
 
for i in range(X, 10**8):
    if prime(i):
        print(i)
        exit(0)
 
print('No prime number in this range')

Buggy python submission (verdict: Runtime Error):

def get_primenumber(N):
    #素数リスト
    prime_list = [2]
    #3からNまでの数字を一つずつ取り出す
    for num in range(3,N+1,2):
      #取り出した数字が素数リストの要素で割れなければ素数リストに追加する
      if all( num % prime != 0 for prime in prime_list):
        prime_list.append(num)

    return prime_list

def main():
    prime = []
    ans = []
    number = int(input())
    prime = get_primenumber(50000)
    print(prime)
    for i in range(number):
        if number < prime[i]:
            ans.append(prime[i])
            
    print(min(ans))

if __name__ == "__main__":
    main()

Fixed submission:

import math
def prime(n):
    for i in range(2, int(math.sqrt(n))):
        if n % i == 0: return False
    return True
 
X = int(input())
 
for i in range(X, 10**8):
    if prime(i):
        print(i)
        exit(0)
 
print('No prime number in this range')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

student_turn = [0] * (n + 1)
for i in range(n):
  student_turn[a[i] - 1] = a.index(a[i]) + 1
student_turn.pop()
print(" ".join(map(str,student_turn)))

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

student_turn = [0] * (n + 1)
for i in range(n):
  student_turn[a[i] - 1] = i + 1
student_turn.pop()
print(" ".join(map(str,student_turn)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
od = len(n)
i = 0
for i in range(1,n +1):
    if od % 2 ==1:
        i += 1
print(i) 

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
  if len(str(i)) % 2 == 1:
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import copy

n = int(input())
a = [int(input()) for _ in range(n)]
for i in range(n):
    a_copy = copy.deepcopy(a)
    a_copy.pop(i)
    print(max(a_copy))

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
a_sort = sorted(a, reverse=True)
for i in range(n):
    if a[i] == a_sort[0]:
        print(a_sort[1])
    else:
        print(a_sort[0])
Buggy python submission (verdict: Runtime Error):
distances = list(map(int, input().split()))
distances.sort()
ans = 0
for i in range(2):
  ans += distances
print(ans)

Fixed submission:
distances = list(map(int, input().split()))
distances.sort()
ans = 0
for i in range(2):
  ans += distances[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
Authority = [list(map(int, input().split())) for _ in range(m)]
cards = set(range(1, n + 1))

for i in range(m):
    gate = set(range(Authority[i][0], Authority[i][1] + 1))
    cards &= gate
print(len(cards))


Fixed submission:
n, m = map(int, input().split())
Authority = [list(map(int, input().split())) for _ in range(m)]
cards = list(range(1, n + 2))
l_list = []
r_list = []
for i in range(m):
    l_list.append(Authority[i][0])
    r_list.append(Authority[i][1])
        
print(len(cards[max(l_list):min(r_list) + 1]))
Buggy python submission (verdict: Runtime Error):
n , k = map(int, input().split())
s = list(input())
for i in range(n):
  if i == k:
  	s[i] = s[i].lower
print("".join(s))

Fixed submission:
n , k = map(int, input().split())
s = list(input())
for i in range(n):
  if i == (k - 1):
  	s[i] = s[i].lower()
print("".join(s))
Buggy python submission (verdict: Runtime Error):
a, b, t = int(input())
count = 0
for i in range(t):
  if i % a == 0:
    count +=1
print(count * b)

Fixed submission:
a, b, t = map(int,input().split())
count = 0
for i in range(1, t+1):
  if i % a == 0:
    count += 1
print(count * b)

Buggy python submission (verdict: Runtime Error):
a, b, t = int(input())
count = 0
for i in range(t):
  if i % a == 0:
    count +=1
print(count * b)

Fixed submission:
a, b, t = map(int,input().split())
count = 0
for i in range(1, t+1):
  if i % a == 0:
    count += 1
print(count * b)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
stores = [tuple(map(int, input().split())) for _ in range(n)]
dict_stores = dict(stores)
lower_cost = sorted(dict_stores.keys())
total = 0
ans = 0
for i in range(n):
    total += dict_stores[lower_cost[i]]
    if total >= m:
        diff = m - (total - dict_stores[lower_cost[i]])
        ans += lower_cost[i] * diff
        break
    else:
        ans += lower_cost[i] * dict_stores[lower_cost[i]]
print(ans)


Fixed submission:
n, m = map(int, input().split())
stores = [list(map(int, input().split())) for _ in range(n)]
sorted_sotres = sorted(stores, key=lambda x: x[0])
total = 0
ans = 0
for cost, number in sorted_sotres:
    if number > m:
        ans += cost * m
        break
    elif number == m:
        ans += cost * number
        break
    else:
        ans += cost * number
    m -= number
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
reverse_count = 0
while "BW" in s:
    reverse_count += s.count("BW")
    s = s.replace("BW", "WB")
print(reverse_count)


Fixed submission:
s = list(input())
W_count = 0
ans = 0
for i in range(len(s)):
    if s[i] == "W":
        ans += i - W_count
        W_count += 1
print(ans)