Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
K, N = map(int, input().split())
Alist = list(map(int, input().split()))
  
#for each house, traverse clock/anti-clock wise
Alen = len(Alist)
min_distance = 10000000
for s in range(Alen):
  distance = 0
  start_p = s
  current_p = s
  next_p = 0 # random number
  #clock-wise
  while (True):
    # calculate next point
    if (current_p == (Alen-1)):
      next_p = 0
    else:
      next_p = current_p+1
    # finish if reached to start point again
    if (next_p == start_p):
      break
    # add distance from current to next point
    if (next_p == 0):
      distance += (K-Alist[current_p]+Alist[next_p])
    else:
      distance += (Alist[next_p]-Alist[current_p])
    # move to next point
    current_p = next_p
   
  if (distance < min_distance):
    min_distance = distance
  #anti- clock-wise
  #distance = 0
  #while (True):
  #  if (s == 0):
   #   distance += (Alist[s]+(K-Alist[s-1]))
   # else:
   #   distance += (Alist[s]-Alist[s-1])
   # s -= 1
  #  if ( (s-1) == ((-1*Alen)+start_p) ):
   #   break
 # print("anti"+str(distance))
  #if (distance < min_distance):
   # min_distance = distance

print(min_distance)
      

Fixed submission:
K, N = input().split()
K = int(K)
N = int(N)
houses = list(map(int, input().split()))
first = True
distance = 0
for i in range(N):
  firstHouse = houses[i]
  lastHouse = houses[i - 1]
  if lastHouse > firstHouse:
    distance = lastHouse - firstHouse
  else:
    distance = (K - firstHouse) + lastHouse
  if first or distance < minDistance:
    minDistance = distance
    first = False
print(minDistance)
Buggy python submission (verdict: Runtime Error):
import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or n == 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or n == 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Fixed submission:
import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or n == 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or m == 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Buggy python submission (verdict: Runtime Error):
import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or n == 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or n == 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Fixed submission:
import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or n == 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or m == 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Buggy python submission (verdict: Runtime Error):
import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Fixed submission:
import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or n == 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or m == 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Buggy python submission (verdict: Runtime Error):
import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Fixed submission:
import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or n == 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or m == 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Buggy python submission (verdict: Runtime Error):
import math
n, m = input().split()
m = int(m)
n = int(n)
mNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
nNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Fixed submission:
import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or n == 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or m == 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))
Buggy python submission (verdict: Runtime Error):
wholeString = input()
firstSub = wholeString[0:int((len(wholeString)-1)/2)]
secondSub = wholeString[int(((len(wholeString)+3)/2)-1):]

if len(wholeString) % 2 == 0 or len(wholeString) < 3 or len(wholeString) > 99:
  print("No")
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1] and wholString == wholeString[::-1]:
  print("Yes")
else:
  print("No")

Fixed submission:
wholeString = input()
firstSub = wholeString[0:int((len(wholeString)-1)/2)]
secondSub = wholeString[int(((len(wholeString)+3)/2)-1):]

if len(wholeString) % 2 == 0 or len(wholeString) < 3 or len(wholeString) > 99:
  print("No")
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1] and wholeString == wholeString[::-1]:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
wholeString = input()
firstSub = wholeString[0:(len(wholeString)-1)/2]
secondSub = wholeString[((len(wholeString)+3)/2)-1:]
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1]:
  print("Yes")
else:
  print("No")

Fixed submission:
wholeString = input()
firstSub = wholeString[0:int((len(wholeString)-1)/2)]
secondSub = wholeString[int(((len(wholeString)+3)/2)-1):]

if len(wholeString) % 2 == 0 or len(wholeString) < 3 or len(wholeString) > 99:
  print("No")
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1] and wholeString == wholeString[::-1]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
li = [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(li[input()-1])

Fixed submission:
li = [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(li[int(input())-1])
Buggy python submission (verdict: Runtime Error):
from decimal import *
num1, num2, num3 = map(int, input().split())
num1 = Decimal(num1)
num2 = Decimal(num2)
num3 = Decimal(num3)
if (num.sqrt() + num2.sqrt() < num3.sqrt()):
  print("Yes")
else:
  print("No")

Fixed submission:
from decimal import *
num1, num2, num3 = map(int, input().split())
num1 = Decimal(num1)
num2 = Decimal(num2)
num3 = Decimal(num3)
if (num1.sqrt() + num2.sqrt() < num3.sqrt()):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
buses = input()
first = buses[0]
count = 0
for i in buses:
	if i == first:
      count += 1
if count == len(buses):
  print("No")
else:
  print("Yes")

Fixed submission:
buses = input()
first = buses[0]
count = 0
for i in buses:
	if (i == first):
    	   count += 1
if count == len(buses):
	print("No")
else:
	print("Yes")
Buggy python submission (verdict: Runtime Error):
S, T = map(int, input().split())
A, B = map(int, input().split())
U = int(input())
if (U == T):
  print(str(A)+" "+str(B-1))
else:
  print(str(A-1)+" "+str(B))



Fixed submission:
S, T = input().split()
A, B = map(int, input().split())
U = input()
if (U == T):
  print(str(A)+" "+str(B-1))
else:
  print(str(A-1)+" "+str(B))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
pList = list(map(int, input().split()))
max_sumK = 0
max_start = 0
max_end = 0
for i in range(N-K+1):
  start = i
  end = i+K
  sumK = sum(pList[start:end])
  if (sumK > max_sumK):
    max_sumK = sumK
    max_start = start
    max_end = end
answer = 0
#print("s"+str(max_start)+"g"+str(max_end))
for num in pList[max_start:max_end]:
  answer += sum(list(range(1, (num+1))))/num
print(answer)

Fixed submission:
N, K = map(int, input().split())
pList = list(map(int, input().split()))
#範囲内の和を求めるには累積和とういうのを使う
#事前準備
cum_sum_list = [0]*(N+1)
cum_sum = 0
pListLen = len(pList)
for i in range(pListLen):
  cum_sum += pList[i]
  cum_sum_list[i+1] = cum_sum
#範囲内の和を比べていく
max_sumK = 0
max_start = 0
max_end = 0
for i in range(N-K+1):
  start = i
  end = (i+K)
  sumK = cum_sum_list[end] - cum_sum_list[start]
  if (sumK > max_sumK):
    max_sumK = sumK
    max_start = start
    max_end = end
#最大の期待値を計算して出力
answer = 0
for num in pList[max_start:max_end]:
  answer += sum(list(range(1, (num+1))))/num
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
# initialize maze
maze = []

for r in range(H):
  maze.append(list(input()))
maxVisit = 0
for row in maze:
  for road in row:
    if (road == "."):
      maxVisit += 1
# do bfs for each point and record maximum steps...
def findMaxBFS(start):
  # initialize BFS
  visitedCount = 1
  visitedPoints = []
  for r in range(H):
    visitedPoints.append([])
    for c in range(W):
      if (r == start[0]) and (c == start[1]):
        visitedPoints[r].append("Y")
      else:
        visitedPoints[r].append("N")
  points = [start]
  directions = [[0,1], [0,-1], [1,0], [-1,0]]
  steps = 0
  # BFS starts
  while (visitedCount < maxVisit):
    steps += 1
    nextPoints = []
    for p in points:
      for d in directions:
        nextP = [p[0]+d[0], p[1]+d[1]]
        #check nextP is inside the maze
        if (0<=nextP[0] and nextP[0]<H) and (0<=nextP[1] and nextP[1]<W):
          road = maze[nextP[0]][nextP[1]]
          #check nextP is walkable = stone
          if (road == "."):
            # check if nextP is already visisted
            if (visitedPoints[nextP[0]][nextP[1]] == "N"):
              nextPoints.append(nextP)
              visitedCount += 1
              visitedPoints[nextP[0]][nextP[1]] = "Y" 
    points = nextPoints
  # BFS ended
  # return max step
  return steps

max_steps = []
for r in range(H):
  for c in range(W):
    max_steps.append(findMaxBFS([r,c]))
print(max(max_steps))
    

Fixed submission:
H, W = map(int, input().split())
# initialize maze
maze = []

for r in range(H):
  maze.append(list(input()))
maxVisit = 0
for row in maze:
  for road in row:
    if (road == "."):
      maxVisit += 1
# do bfs for each point and record maximum steps...
def findMaxBFS(start):
  #check start point is valid
  if (maze[start[0]][start[1]] == "#"):
    return 0
  # initialize BFS
  visitedCount = 1
  visitedPoints = []
  for r in range(H):
    visitedPoints.append([])
    for c in range(W):
      if (r == start[0]) and (c == start[1]):
        visitedPoints[r].append("Y")
      else:
        visitedPoints[r].append("N")
  points = [start]
  directions = [[0,1], [0,-1], [1,0], [-1,0]]
  steps = 0
  # BFS starts
  while (visitedCount < maxVisit):
    steps += 1
    nextPoints = []
    for p in points:
      for d in directions:
        nextP = [p[0]+d[0], p[1]+d[1]]
        #check nextP is inside the maze
        if (0<=nextP[0] and nextP[0]<H) and (0<=nextP[1] and nextP[1]<W):
          road = maze[nextP[0]][nextP[1]]
          #check nextP is walkable = stone
          if (road == "."):
            # check if nextP is already visisted
            if (visitedPoints[nextP[0]][nextP[1]] == "N"):
              nextPoints.append(nextP)
              visitedCount += 1
              visitedPoints[nextP[0]][nextP[1]] = "Y" 
    points = nextPoints
  # BFS ended
  # return max step
  return steps

max_steps = []
for r in range(H):
  for c in range(W):
    max_steps.append(findMaxBFS([r,c]))
print(max(max_steps))
Buggy python submission (verdict: Runtime Error):
from collections import deque
N, M = map(int, input().split())
class tree():
    def __init__(self):
        self.num = 0
        self.flag = 0
        self.step = -1
        self.leaf = []

li = [tree() for i in range(N)]
def saiki(que, step):
    pop = que.pop()
    li[pop].flag = 2


    for i in range(len(li[pop].leaf)):
        if li[li[pop].leaf[i]].flag == 0:
            que.append(li[pop].leaf[i])
            li[li[pop].leaf[i]].flag = 1
            if li[li[pop].leaf[i]].step != -1:
                if li[li[pop].leaf[i]].step > li[pop].step + 1:
                    li[li[pop].leaf[i]].step = li[pop].step + 1
                    li[li[pop].leaf[i]].num = pop
            else:
                li[li[pop].leaf[i]].step = li[pop].step + 1
                li[li[pop].leaf[i]].num = pop


    #print(que)
    if len(que) != 0:
        saiki(que, li[pop].step)
for i in range(M):
    A, B = map(int, input().split())
    li[A-1].leaf.append(B-1)
    li[B-1].leaf.append(A-1)

que = deque()
que.append(0)
li[0].step = 0
saiki(que, 0)
flag = 1
for i in range(len(li)):
    if li[i].flag == 0:
        flag = 0
        break
if flag == 0:
    print("No")
else:
    print("Yes")
for i in range(1, len(li)):
    print(li[i].num+1)

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10000000)
N, M = map(int, input().split())
class tree():
    def __init__(self):
        self.num = 0
        self.flag = 0
        self.step = -1
        self.leaf = []

li = [tree() for i in range(N)]
def saiki(que, step):
    pop = que.popleft()
    li[pop].flag = 2


    for i in range(len(li[pop].leaf)):
        if li[li[pop].leaf[i]].flag == 0:
            que.append(li[pop].leaf[i])
            li[li[pop].leaf[i]].flag = 1
            if li[li[pop].leaf[i]].step != -1:
                if li[li[pop].leaf[i]].step > li[pop].step + 1:
                    li[li[pop].leaf[i]].step = li[pop].step + 1
                    li[li[pop].leaf[i]].num = pop
            else:
                li[li[pop].leaf[i]].step = li[pop].step + 1
                li[li[pop].leaf[i]].num = pop


    #print(que)
    if len(que) != 0:
        saiki(que, li[pop].step)
for i in range(M):
    A, B = map(int, input().split())
    li[A-1].leaf.append(B-1)
    li[B-1].leaf.append(A-1)

que = deque()
que.append(0)
li[0].step = 0
saiki(que, 0)
flag = 1

for i in range(len(li)):
    if li[i].flag == 0:
        flag = 0
        break
if flag == 0:
    print("No")
else:
    print("Yes")
for i in range(1, len(li)):
    print(li[i].num+1)
Buggy python submission (verdict: Runtime Error):
S = input()
def kaibun(st):
    stre = st[::-1]
    if st == stre:
        return 1
    else:
        return 0

if kaibun(S[0:(len(S)-1) // 2]) and kaibun(S) and kaibun(S[(len(S)+3) // 2]):
    print("Yes")
else:
    print("No")


Fixed submission:
S = input()
def kaibun(st):
    stre = st[::-1]
    if st == stre:
        return 1
    else:
        return 0

if kaibun(S[0:(len(S)-1) // 2]) and kaibun(S) and kaibun(S[(len(S)+3) // 2-1:len(S)]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A= list(map(int, input().split()))
mod = 10 ** 9 + 7
sum = 0
for i in range(60):
    count0 = 0
    count1 = 0
    count2 = 0

    for j in range(N):
        if A[j] & 1:
            count1 += 1
        else:
            count0 += 1
        A[j] = A[j] >> 1
    count2 = count0 * count1
    sum += count2 * (2 ** i)

print(sum % mod)


Fixed submission:
N = int(input())
A= list(map(int, input().split()))
mod = 10 ** 9 + 7
sum = 0
for i in range(60):
    count0 = 0
    count1 = 0
    count2 = 0

    for j in range(N):
        if A[j] & 1:
            count1 += 1
        else:
            count0 += 1
        A[j] = A[j] >> 1
    count2 = count0 * count1
    sum += count2 * (2 ** i)

print(sum % mod)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A= list(map(int, input().split()))
mod = 10 ** 9 + 7
sum = 0
for i in range(N-1):
    for j in range(i+1, N):
        sum += A[i] ^ A[j]
print(sum % mod)

Fixed submission:
N = int(input())
A= list(map(int, input().split()))
mod = 10 ** 9 + 7
sum = 0
for i in range(60):
    count0 = 0
    count1 = 0
    count2 = 0

    for j in range(N):
        if A[j] & 1:
            count1 += 1
        else:
            count0 += 1
        A[j] = A[j] >> 1
    count2 = count0 * count1
    sum += count2 * (2 ** i)

print(sum % mod)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N= int(input())
L = list(map(int, input().split()))

L.sort(reverse=True)

#print(L)
for i in range(N):
    L[i] *= -1
count = 0
for i in range(N-2):
    #print(i)
    for j in range(i+1, N-1):
        if -L[i] >= -L[j] * 2:
            break
        data = L[i] - L[j]
        #print(data, L[j + 1 : N])
        #print(bisect.bisect_left(L[j + 1 : N], data))
        count += bisect.bisect_left(L[j + 1 : N], data)

print(count)

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

L.sort(reverse=True)

#print(L)
for i in range(N):
    L[i] *= -1
count = 0
for i in range(N-2):
    #print(i)
    for j in range(i+1, N-1):
        if -L[i] >= -L[j] * 2:
            break
        data = L[i] - L[j]
        #print(data, L[j + 1 : N])
        #print(bisect.bisect_left(L[j + 1 : N], data))
        count += bisect.bisect_left(L, data) - (j+1)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N= int(input())
L = list(map(int, input().split()))

L.sort(reverse=True)

#print(L)
count = 0
for i in range(N-2):
    #print(i)
    for j in range(i+1, N-1):
        if L[i] >= L[j] * 2:
            break
        for k in range(j+1, N):
            #print(L[i], L[j], L[k])
            if L[i] >= L[j] + L[k]:
                break
            count += 1
print(count)

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

L.sort(reverse=True)

#print(L)
for i in range(N):
    L[i] *= -1
count = 0
for i in range(N-2):
    #print(i)
    for j in range(i+1, N-1):
        if -L[i] >= -L[j] * 2:
            break
        data = L[i] - L[j]
        #print(data, L[j + 1 : N])
        #print(bisect.bisect_left(L[j + 1 : N], data))
        count += bisect.bisect_left(L, data) - (j+1)

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

A = list(map(int, input().split()))
def soujyuu(left, right, num):
    if right - left <= 1:
        A.insert(right, num)
    else:
        if num >= A[left + right // 2]:
            left = left + right // 2
        else:
            right = left + right // 2
        soujyuu(left, right, num)


A.sort()
for i in range(M):
    maxA = A.pop(N-1)
    maxA = maxA // 2
    soujyuu(0,N-2, maxA)
    #print(A)

print(sum(A))


Fixed submission:
S = input()

if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

A = list(map(int, input().split()))
def soujyuu(left, right, num):
    if right - left <= 1:
        A.insert(right, num)
    else:
        if num >= A[left + right // 2]:
            left = left + right // 2
        else:
            right = left + right // 2
        soujyuu(left, right, num)


A.sort()
for i in range(M):
    maxA = A.pop(N-1)
    maxA = maxA // 2
    soujyuu(0,N-2, maxA)
    #print(A)

print(sum(A))


Fixed submission:
import heapq
N, M = map(int, input().split())

A = list(map(int, input().split()))
h = []

for i in range(N):
    A[i] *= -1

for i in range(N):
    heapq.heappush(h, A[i])

for i in range(M):
    num = heapq.heappop(h)
    num = num * -1
    num = num // 2
    heapq.heappush(h, -num)

print(-sum(h))

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

A = list(map(int, input().split()))
def soujyuu(left, right, num):
    if right - left <= 1:
        A.insert(right, num)
    else:
        if num >= A[left + right // 2]:
            left = left + right // 2
        else:
            right = left + right // 2
        soujyuu(left, right, num)


A.sort()
for i in range(M):
    maxA = A.pop(N-1)
    maxA = maxA // 2
    soujyuu(0,N-2, maxA)
    #print(A)

print(sum(A))


Fixed submission:
import heapq
N, M = map(int, input().split())

A = list(map(int, input().split()))
h = []

for i in range(N):
    A[i] *= -1

for i in range(N):
    heapq.heappush(h, A[i])

for i in range(M):
    num = heapq.heappop(h)
    num = num * -1
    num = num // 2
    heapq.heappush(h, -num)

print(-sum(h))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

A = list(map(int, input().split()))

for i in range(M):
    maxA = max(A)
    A.remove(maxA)
    maxA = maxA // 2
    A.append(maxA)

print(sum(A))

Fixed submission:
import heapq
N, M = map(int, input().split())

A = list(map(int, input().split()))
h = []

for i in range(N):
    A[i] *= -1

for i in range(N):
    heapq.heappush(h, A[i])

for i in range(M):
    num = heapq.heappop(h)
    num = num * -1
    num = num // 2
    heapq.heappush(h, -num)

print(-sum(h))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

A = list(map(int, input().split()))

for i in range(M):
    maxA = max(A)
    A.remove(maxA)
    maxA = maxA // 2
    A.append(maxA)

print(sum(A))

Fixed submission:
import heapq
N, M = map(int, input().split())

A = list(map(int, input().split()))
h = []

for i in range(N):
    A[i] *= -1

for i in range(N):
    heapq.heappush(h, A[i])

for i in range(M):
    num = heapq.heappop(h)
    num = num * -1
    num = num // 2
    heapq.heappush(h, -num)

print(-sum(h))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
count = 0
for i in range(N):
    count += i
print(count)

Fixed submission:
N = int(input())
count = N * (N - 1) // 2
print(count)
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
m = 673
if R // m - (L - 1) // m != 0:
    print(0)
else:
    minnum = 1000
    Lmod = L % m
    Rmod = R % m
    for i in range(Lmod, Rmod+1):
        for j in range(i + 1, Rmod+1):
            #print(i, j, (i * j) % 2019)
            minnum = min(minnum, (i * j) % 2019)
    print(minnum)


Fixed submission:
N, A, B = map(int, input().split())
sume = N * A
print(min(B, sume))
Buggy python submission (verdict: Runtime Error):
def saidaikouyaku(a, b):
    if b > a:
        a, b = b, a

    while b != 0:
        a, b=b,(a%b)
    return a

A, B, C, D = map(int, input().split())
hani = B - A + 1
Cnum = int(B / C) - int((A - 1) / C)
Dnum = int(B / D) - int((A - 1) / D)
saisyoukoubai = int(C * D / saidaikouyaku(C, D))
koubainum = int(B / saisyoukoubai) - int((A - 1) / saisyoukoubai)
#print(hani)
#print(Cnum, Dnum, koubainum, saisyoukoubai)
print(hani - Cnum - Dnum + koubainum)


Fixed submission:
S = int(input())

a = S % 10
b = int((S % 100) / 10)
c = int(S % 1000 / 100)
d = int(S / 1000)

if a == b or b == c or c == d:
    print("Bad")
else:
    print("Good")
Buggy python submission (verdict: Time Limit Exceeded):
def saidaikouyaku(a, b):
    if b > a:
        a, b = b, a

    while b != 0:
        a, b=b,a%b
    return a

A, B, C, D = map(int, input().split())
hani = B - A + 1
count = 0
count2 = 0
count3 = 0
saisyoukoubai = int(C * D / saidaikouyaku(C, D))
for i in range(A, B + 1):
    if i % C == 0:
        count += 1
    if i %  D == 0:
        count2 += 1
    if i % saisyoukoubai == 0:
        count3 += 1

print(hani - count - count2 + count3)



Fixed submission:
def saidaikouyaku(a, b):
    if b > a:
        a, b = b, a

    while b != 0:
        a, b=b,(a%b)
    return a

A, B, C, D = map(int, input().split())
hani = B - A + 1
Cnum = B // C - (A - 1) // C
Dnum = B // D - (A - 1) // D
saisyoukoubai = C * D // saidaikouyaku(C, D)
koubainum = B // saisyoukoubai - int(A - 1) // saisyoukoubai
#print(hani)
#print(Cnum, Dnum, koubainum, saisyoukoubai)
print(hani - Cnum - Dnum + koubainum)