Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
A = list(map(int,input().split()))  
tempA = 1
for i in range(K):
  tempA *= A[i]

for i in range(N - K):
  mulA = tempA / A[i] * A[K+i]
  if tempA < mulA:
    print('Yes')
  else:
    print('No')
  tempA = mulA

  

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))  
for i in range(N - K):
  if A[i] < A[K+i]:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce

N,K = map(int,input().split())
A = list(map(int,input().split()))  
tempA = reduce(mul, A[0:K])

for i in range(N - K):
  mulA = tempA / A[i] * A[K+i]
  if tempA < mulA:
    print('Yes')
  else:
    print('No')
  tempA = mulA

  

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))  
for i in range(N - K):
  if A[i] < A[K+i]:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce

N,K = map(int,input().split())
A = list(map(int,input().split()))  
tempA = reduce(mul, A[0:K])

for i in range(N - K):
  mulA = reduce(mul, A[i+1:K+i+1])
  if tempA < mulA:
    print('Yes')
  else:
    print('No')
  tempA = mulA


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

resultA = N * 100 // 108
resultB = resultA + 1
valueA = resultA * 108 // 100
valueB = resultB * 108 // 100

if N == valueA:
  print(resultA)
elif N == valueB:
  print(resultB)
else:
  print(result)
  print(value)
  print(':(')

Fixed submission:
N = int(input())

resultA = N * 100 // 108
resultB = resultA + 1
valueA = resultA * 108 // 100
valueB = resultB * 108 // 100

if N == valueA:
  print(resultA)
elif N == valueB:
  print(resultB)
else:
  print(':(')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
result = 0

for i in range(N):
  result += i
  
print(result)

Fixed submission:
N = int(input())

print(N * (N - 1) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
inputS = input()
S = list(inputS)
count = 0
tmpI = 0
tmpJ = 0

for _ in range(inputS.count('W')):
  i = inputS.find('W',tmpI)
  tmpI = i + 1
  j = inputS.find('B',tmpJ)
  tmpJ = j + 1
  S = list(inputS)
  S[i] = 'B'
  inputS = ''.join(S)
  count += (i-j)    
print(count)

Fixed submission:
S = list(input())
count = 0
valueA = 0
for i in range(len(S)):
  if S[i] == 'B':
    count += 1
    valueA += i

valueB = 0
for i in range(count):
  valueB += (len(S) - 1 - i)
  
print(valueB - valueA)

Buggy python submission (verdict: Time Limit Exceeded):
inputS = input()
S = list(inputS)
count = 0
tmpI = 0
tmpJ = 0

for _ in range(inputS.count('W')):
  i = inputS.find('W',tmpI)
  tmpI = i + 1
  for j in range(tmpJ,i):
    if S[j] == 'B':
      tmpJ = j + 1
      S[i] = 'B'
      count += (i-j)
      break
    
print(count)

Fixed submission:
S = list(input())
count = 0
valueA = 0
for i in range(len(S)):
  if S[i] == 'B':
    count += 1
    valueA += i

valueB = 0
for i in range(count):
  valueB += (len(S) - 1 - i)
  
print(valueB - valueA)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
count = 0

tmpJ = 0
for i in range(len(S)):
  if S[i] == 'W':
    for j in range(tmpJ,i):
      if S[j] == 'B':
        tmpJ = j + 1
        S[i] = 'B'
        count += (i-j)
        break
print(count)

Fixed submission:
S = list(input())
count = 0
valueA = 0
for i in range(len(S)):
  if S[i] == 'B':
    count += 1
    valueA += i

valueB = 0
for i in range(count):
  valueB += (len(S) - 1 - i)
  
print(valueB - valueA)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
count = 0

tmpJ = 0
for i in range(len(S)):
  if S[i] == 'W':
    for j in range(tmpJ,i):
      if S[j] == 'B':
        tmpJ = j + 1
        S[i] = 'B'
        S[j] = 'W'
        count += (i-j)
        break
print(count)

Fixed submission:
S = list(input())
count = 0
valueA = 0
for i in range(len(S)):
  if S[i] == 'B':
    count += 1
    valueA += i

valueB = 0
for i in range(count):
  valueB += (len(S) - 1 - i)
  
print(valueB - valueA)

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
count = 0

for i in range(len(S)):
  if S[i] == 'W':
    for j in range(i):
      if S[j] == 'B':
        S[i] = 'B'
        S[j] = 'W'
        count += (i-j)
        break
print(count)

Fixed submission:
S = list(input())
count = 0
valueA = 0
for i in range(len(S)):
  if S[i] == 'B':
    count += 1
    valueA += i

valueB = 0
for i in range(count):
  valueB += (len(S) - 1 - i)
  
print(valueB - valueA)
Buggy python submission (verdict: Time Limit Exceeded):
import math
a, b, n = map(int, input().split())
max = 0

for x in range(1, n+1):
    if(x > b):
        continue
    tmp = math.floor((a*x) / b) - a * math.floor(x/b)
    if tmp > max:
        max = tmp

print(max)


Fixed submission:
import math
a, b, n = map(int, input().split())
x = min(b-1, n)
print(math.floor((a*x)/b) - a * math.floor(x/b))

Buggy python submission (verdict: Time Limit Exceeded):
import math
a, b, n = map(int, input().split())
max = 0

for x in range(1, n+1):
    tmp = math.floor((a*x) / b) - a * math.floor(x/b)
    if tmp > max:
        max = tmp

print(max)


Fixed submission:
import math
a, b, n = map(int, input().split())
x = min(b-1, n)
print(math.floor((a*x)/b) - a * math.floor(x/b))
Buggy python submission (verdict: Time Limit Exceeded):
import math
N=int(input())
R=0

def gcd_3(a,b,c):
  return math.gcd(math.gcd(a,b), c)

for a in range(1,N+1):
  for b in range(1,N+1):
    for c in range(1,N+1):
      R+=gcd_3(a,b,c)

print(R)

Fixed submission:
import math
N=int(input())
R=0

def gcd_3(a,b,c):
  return math.gcd(math.gcd(a,b), c)

for a in range(1,N+1):
  for b in range(1,N+1):
    for c in range(1,N+1):
      R+=gcd_3(a,b,c)

print(R)
Buggy python submission (verdict: Time Limit Exceeded):
K,S = input().split()
count = 0

for x in range(int(K)+1):
  for y in range(int(K)+1):
    if int(S)-x-y >=0 and int(S)-x-y <=int(K):
      count+=1


print(count)

Fixed submission:
K,S = [int(x) for x in input().split()]
count = 0

for x in range(int(K)+1):
  for y in range(int(K)+1):
    if 0<=S-x-y<=K:
      count+=1


print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = input().split()
count = 0

# O(K^3)になるため間に合わない
# for x in range(int(K)+1):
#   for y in range(int(K)+1):
#     for z in range(int(K)+1):
#       if x+y+z== int(S):
#         count+=1

for x in range(int(K)+1):
  for y in range(int(K)+1):
    if int(S)-x-y >=0 and int(S)-x-y <=int(K):
      count+=1


print(count)

Fixed submission:
K,S = [int(x) for x in input().split()]
count = 0

for x in range(int(K)+1):
  for y in range(int(K)+1):
    if 0<=S-x-y<=K:
      count+=1


print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = input().split()
count = 0

# O(K^3)になるため間に合わない
# for x in range(int(K)+1):
#   for y in range(int(K)+1):
#     for z in range(int(K)+1):
#       if x+y+z== int(S):
#         count+=1

for x in range(int(K)+1):
  for y in range(int(K)+1):
    if int(S)-x-y >=0 and int(S)-x-y <=int(K):
      count+=1


print(count)

Fixed submission:
K,S = [int(x) for x in input().split()]
count = 0

for x in range(int(K)+1):
  for y in range(int(K)+1):
    if 0<=S-x-y<=K:
      count+=1


print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = input().split()
count = 0

for x in range(int(K)+1):
  for y in range(int(K)+1):
    for z in range(int(K)+1):
      if x+y+z== int(S):
        count+=1

print(count)

Fixed submission:
K,S = [int(x) for x in input().split()]
count = 0

for x in range(int(K)+1):
  for y in range(int(K)+1):
    if 0<=S-x-y<=K:
      count+=1


print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = input().split()
count = 0

for x in range(int(K)+1):
  for y in range(int(K)+1):
    for z in range(int(K)+1):
      if x+y+z== int(S):
        count+=1

print(count)

Fixed submission:
K,S = [int(x) for x in input().split()]
count = 0

for x in range(int(K)+1):
  for y in range(int(K)+1):
    if 0<=S-x-y<=K:
      count+=1


print(count)
Buggy python submission (verdict: Runtime Error):
s = input().sprit()
if s[0]==s[1] and s[0]!=s[2] print("Yes")
elif s[0]==s[2] and s[0]!=s[1] print("Yes")
elif s[2]==s[1] and s[0]!=s[2] print("Yes")
else print("No")

Fixed submission:
s = input().split()
if s[0]==s[1] and s[0]!=s[2]:
  print("Yes")
elif s[0]==s[2] and s[0]!=s[1]:
  print("Yes")
elif s[2]==s[1] and s[0]!=s[2]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int,input().split())
lst = [-1 for i in range(n + 1)]
lst[0] = 0
def find (x):
    if (lst[x] < 0):
        return(x)
    else:
        return (find(lst[x]))
def unit(x, y):
    xp = find(x)
    yp = find(y)
    if (xp == yp):
        pass
    else:
        lst[yp] = xp
for i in range(m):
    a, b = map(int,input().split())
    unit(a, b)

ans = -1
for i in range(n + 1):
    if (lst[i] == -1):
        ans = ans + 1

print(ans)


Fixed submission:
n, m = map(int,input().split())
lst = [-1 for i in range(n + 1)]
lst[0] = 0
def find (x):
    if (lst[x] < 0):
        return(x)
    else:
        z = find(lst[x])
        lst[x] = z
        return (z)
def unit(x, y):
    xp = find(x)
    yp = find(y)
    if (xp == yp):
        pass
    else:
        lst[yp] = xp
for i in range(m):
    a, b = map(int,input().split())
    unit(a, b)

ans = -1
for i in range(n + 1):
    if (lst[i] == -1):
        ans = ans + 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n, x, m = map(int,input().split())
lst = [0 for i in range(m)]
lst2 = [x]
i = 2
lst[x] = 1
while True:
    if (i > n):
        break
    x = x**2%m
    if (lst[x] == 0):
        lst[x] = i
        lst2.append(lst2[i - 2] + x)
        i = i + 1
    else:
        lst2.append(lst2[i - 2] + x)
        break
a = i - lst[x]
b = lst2[i - 1] - lst2[i - 1 - a]
i = i - 1
c = (n - i)//a
d = (n - i)%a
ans = lst2[i - 1] + b*c + lst2[i - 1 - a + d] - lst2[i - 1 - a]
print(ans)


Fixed submission:
n, x, m = map(int,input().split())
lst = [0 for i in range(m)]
lst2 = [x]
i = 2
lst[x] = 1
c = 0
while True:
    if (i > n):
        break
    x = x**2%m
    if (lst[x] == 0):
        lst[x] = i
        lst2.append(lst2[i - 2] + x)
        i = i + 1
    else:
        lst2.append(lst2[i - 2] + x)
        c = 1
        break
if (c == 1):
    a = i - lst[x]
    b = lst2[i - 1] - lst2[i - 1 - a]

    c = (n - i)//a
    d = (n - i)%a
    ans = lst2[i - 1] + b*c + lst2[i - 1 - a + d] - lst2[i - 1 - a]
    print(ans)

else:
    print(lst2[n - 1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = list(map(int,input().split()))
ans = 0
for i in range(n - 1):
  for j in range(i + 1, n):
    x = lst[i]*lst[j]
    ans = (ans + x)%(10**9 + 7)
print(ans)

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
x = sum(lst)%((10**9 + 7)*2)
y = x**2%((10**9 + 7)*2)
z = 0
for i in range(n):
    z = (z + (lst[i]%((10**9 + 7)*2))**2)%((10**9 + 7)*2)
ans = int((y - z)%((10**9 + 7)*2)/2)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
if (s = "SSS"):
  print("0")
elif (s = "SSR"):
  print("1")
elif (s = "SRS"):
  print("1")
elif (s = "RSS"):
  print("1")
elif (s = "SRR"):
  print("2")
elif (s = "RSR"):
  print("1")
elif (s = "RRS"):
  print("2")
else:
  print("3")
  

Fixed submission:
s = input()
if (s == "SSS"):
  print("0")
elif (s == "SSR"):
  print("1")
elif (s == "SRS"):
  print("1")
elif (s == "RSS"):
  print("1")
elif (s == "SRR"):
  print("2")
elif (s == "RSR"):
  print("1")
elif (s == "RRS"):
  print("2")
else:
  print("3")
Buggy python submission (verdict: Runtime Error):
n = input()
lst = list(map(int,input().split()))
ans = 0
for i in range (n - 2):
  for j in range (i + 1, n - 1):
    for k in range (j + 1, n):
      lst2 = [lst[i], lst[j], lst[k]]
      lst3 = sorted(lst2)
      if(lst3[2] < lst3[1] + lst3[0]):
        ans = ans + 1
print(ans)

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
ans = 0
for i in range (n - 2):
  for j in range (i + 1, n - 1):
    for k in range (j + 1, n):
      lst2 = [lst[i], lst[j], lst[k]]
      if (lst2[0] != lst2[1] and lst2[0] != lst2[2] and lst2[1] != lst2[2]):
        if (lst2[0] < lst2[1] + lst2[2] and lst2[1] < lst2[0] + lst2[2] and lst2[2] < lst2[0] + lst2[1]):
          ans = ans + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = n%10
if (x == 2, or x == 4, or x == 5, or x == 7, or x == 9):
  print("hon")
elif (x == 0, or x == 1, or x == 6, or x == 8):
  print("pon")
else:
  print("bon")

Fixed submission:
n = int(input())
x = n%10
if (x == 2 or x == 4 or x == 5 or x == 7 or x == 9):
  print("hon")
elif (x == 0 or x == 1 or x == 6 or x == 8):
  print("pon")
else:
  print("bon")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input
if (len(s) <= n):
  print(s)
else:
  for i in range (n):
    print(s[i], end = '')
  print()

Fixed submission:
n = int(input())
s = input()
x = len(s)
if (x <= n):
  print(s)
else:
  for i in range (n):
    print(s[i], end = '')
  print("...")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = []
for i in range(n):
  x = input()
  if (x not in lst):
    lst.append(x)
print(len(lst))

Fixed submission:
n = int(input())
lst = []
for i in range(n):
  x = input()
  lst.append(x)
print(len(set(lst)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
lst = list(map(int,input().split()))
lst2 = [0 for i in range(n)]
for i in range(n):
  x = lst[i]
  lst2[x - 1] = lst2[x - 1] + 1
for i in range(n):
  print(lst2[i])

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
lst2 = [0 for i in range(n)]
for i in range(n - 1):
  x = lst[i]
  lst2[x - 1] = lst2[x - 1] + 1
for i in range(n):
  print(lst2[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = list(map(int,input().split()))
for i in range(n):
  print(lst.count(i + 1))

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
lst2 = [0 for i in range(n)]
for i in range(n - 1):
  x = lst[i]
  lst2[x - 1] = lst2[x - 1] + 1
for i in range(n):
  print(lst2[i])
Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
lst = list(map(int,input().split()))
lst.sort()
lst.reverse()
x = sum(lst)
if (lst[m] < x/4/m):
  print("No")
else:
  print("Yes")


Fixed submission:
n, m = map(int,input().split())
lst = list(map(int,input().split()))
lst.sort()
lst.reverse()
x = sum(lst)
if (lst[m - 1] < x/4/m):
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
lst = list(map(int,input().split()))
lst = sorted(lst)
lst = reversed(lst)
x = sum(lst)
if (lst[m] < x/4/m):
  print("No")
else:
  print("Yes")

Fixed submission:
n, m = map(int,input().split())
lst = list(map(int,input().split()))
lst.sort()
lst.reverse()
x = sum(lst)
if (lst[m - 1] < x/4/m):
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
x1 = n%k
x2 = k - x1
print(min[x1, x2])

Fixed submission:
n, k = map(int,input().split())
x1 = n%k
x2 = k - x1
print(min(x1, x2))
Buggy python submission (verdict: Runtime Error):
s = input()
if (s = "AAA" or s = "BBB"):
  print("No")
else:
  print("Yes")

Fixed submission:
s = input()
if (s == "AAA" or s == "BBB"):
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
b = []
for i in range(3):
  lst = list(map(int,input().split()))
  b.append(lst)
n = int(input())
for i in range(n):
  a = int(input())
  for j in range(3):
    for k in range(3):
      if (b[j][k] == a):
        b[j][k] = 0
if (b[0][0] = b[0][1] = b[0][2] or b[1][0] = b[1][1] = b[1][2] or b[2][0] = b[2][1] = b[2][2] or b[0][0] = b[1][0] = b[2][0] or b[0][1] = b[1][1] = b[2][1] or b[0][2] = b[1][2] = b[2][2] or b[0][0] = b[1][1] = b[2][2] or b[0][2] = b[1][1] = b[2][0]):
  print("Yes")
else:
  print("No")
  

Fixed submission:
b = []
for i in range(3):
  lst = list(map(int,input().split()))
  b.append(lst)
n = int(input())
for i in range(n):
  a = int(input())
  for j in range(3):
    for k in range(3):
      if (b[j][k] == a):
        b[j][k] = 0
if (b[0][0] == b[0][1] == b[0][2] or b[1][0] == b[1][1] == b[1][2] or b[2][0] == b[2][1] == b[2][2] or b[0][0] == b[1][0] == b[2][0] or b[0][1] == b[1][1] == b[2][1] or b[0][2] == b[1][2] == b[2][2] or b[0][0] == b[1][1] == b[2][2] or b[0][2] == b[1][1] == b[2][0]):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, r = map(int,input()split())
if (n >= 10):
  print(r)
else:
  sa = 100*(10 - n)
  print(r + sa)

Fixed submission:
n, r = map(int,input().split())
if (n >= 10):
  print(r)
else:
  sa = 100*(10 - n)
  print(r + sa)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
i = 1
x = k
while True:
  if (x >= n):
    print(i)
    break
  else:
    i = i + 1


Fixed submission:
n, k = map(int,input().split())
i = 1
x = k
while True:
  if (x > n):
    print(i)
    break
  else:
    i = i + 1
    x = x*k

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
i = 1
while True:
  x = k
  if (x >= n):
    print(i)
    break
  else:
    i = i + 1

Fixed submission:
n, k = map(int,input().split())
i = 1
x = k
while True:
  if (x > n):
    print(i)
    break
  else:
    i = i + 1
    x = x*k

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
while True:
  i = 1
  x = k
  if (x >= n):
    print(i)
    break
  else:
    i = i + 1
    x = x*k
    

Fixed submission:
n, k = map(int,input().split())
i = 1
x = k
while True:
  if (x > n):
    print(i)
    break
  else:
    i = i + 1
    x = x*k
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = list(map(int,input().split()))
ans = 0
for i in range(len(lst)):
    if (lst.count(lst[i]) != 1):
        ans = 1

if (ans == 0):
    print("YES")
else:
    print("NO")


Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
x = len(lst)
lst = list(set(lst))
y = len(lst)

if (x == y):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
h, a = int(input())
if (h%a == 0):
  print(h//a)
else:
  print(h//a + 1)

Fixed submission:
h, a = map(int,input().split())
if (h%a == 0):
  print(h//a)
else:
  print(h//a + 1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
x = len(s)
for i in range(x):
  a = s[i]
  b = ord(a)
  c = ord("A")
  d = (b + n - c)%26
  s[i] = chr(c + d)
print(s)

Fixed submission:
n = int(input())
s = input()
x = len(s)
for i in range(x):
  a = s[i]
  b = ord(a)
  c = ord("A")
  d = (b + n - c)%26
  print(chr(c + d), end = '')
print()
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()))

for i in range(n):
  if (i == 0):
    ans =b[a[0] - 1]
    y = a[0]
  else:
    x = a[i]
    if (x - y == 1):
      ans = ans + b[x - 1] + c[x - 1]
    else:
      ans = ans + b[x - 1]
    y = x

print(ans)

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

for i in range(n):
  if (i == 0):
    ans =b[a[0] - 1]
    y = a[0]
  else:
    x = a[i]
    if (x - y == 1):
      ans = ans + b[x - 1] + c[y - 1]
    else:
      ans = ans + b[x - 1]
    y = x

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
count = 0
lst = []
for i in range(n - 1):
    if (h[i] >= h[i + 1]):
        count = count + 1
    else:
        lst.append(count)
        count = 0
if (count != 0):
    lst.append(count)

lst.sort()
lst.reverse()

print(lst[0])


Fixed submission:
n = int(input())
h = list(map(int,input().split()))
count = 0
lst = []
if (n == 1):
    print(0)
else:
    for i in range(n - 1):
        if (h[i] >= h[i + 1]):
            count = count + 1
        else:
            lst.append(count)
            count = 0
    if (count != 0):
        lst.append(count)

    lst.sort()
    lst.reverse()

    print(lst[0])
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int,input()split())
ans = c - (a - b)
if(ans < 0):
  print(0)
else:
  print(ans)

Fixed submission:
a, b, c = map(int,input().split())
ans = c - (a - b)
if(ans < 0):
  print(0)
else:
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int,input().split())
lst = [0 for i in range(n)]
for i in range(m):
    l, r = map(int,input().split())
    for j in range(l - 1, r):
        lst[j] = lst[j] + 1
ans = 0
for i in range(n):
    if(lst[i] == m):
        ans = ans + 1
print(ans)


Fixed submission:
n, m = map(int,input().split())
for i in range(m):
    if (i == 0):
        l, r = map(int,input().split())
    else:
        l2, r2 = map(int,input().split())
        l = max(l, l2)
        r = min(r, r2)
if (l > r):
    print(0)
else:
    print(r - l + 1)
Buggy python submission (verdict: Runtime Error):
def dfs(f):
    if vis[f] == 1: return
    vis[f] = 1
    for t in V[f]:
        dfs(t)
          
          
n, m = map(int, input().split())
E = [[*map(lambda x: int(x)-1, input().split())] for _ in range(m)]
V = [[] for _ in range(n)]
for a, b in E: V[a].append(b); V[b].append(a)
ans = 0
vis = [0]*n

for a in range(n):
    if vis[a]==1:
      continue
    ans+=1
    dfs(a)
print(ans-1)


Fixed submission:
import sys
sys.setrecursionlimit(10**7)

def dfs(f):
    if vis[f] == 1: return
    vis[f] = 1
    for t in V[f]:
        dfs(t)
          
          
n, m = map(int, input().split())
E = [[*map(lambda x: int(x)-1, input().split())] for _ in range(m)]
V = [[] for _ in range(n)]
for a, b in E: V[a].append(b); V[b].append(a)
ans = 0
vis = [0]*n

for a in range(n):
    if vis[a]==1:
      continue
    ans+=1
    dfs(a)
print(ans-1)