Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N, Ma, Mb = map(int, input().split())
L = [[int(i) for i in input().split()] for _ in range(N)]

inf = N * 101
dp = [[[inf for _ in range(N*10+11)] for _ in range(N*10+11)] for _ in range(N+1)]

dp[0][0][0] = 0
cmb = itertools.product(range(N), range(N*10), range(N*10))
for i, j, k in cmb:
    dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])
    dp[i+1][j+L[i][0]][k+L[i][1]] = min(dp[i+1][j+L[i][0]][k+L[i][1]], dp[i][j][k] + L[i][2])
ans = inf
for i in range(1, N*10//max(Ma, Mb)):
    ans = min(ans, dp[N][i*Ma][i*Mb])

if ans == inf:
    print(-1)
else:
    print(ans)


Fixed submission:
import itertools
N, Ma, Mb = map(int, input().split())
L = [[int(i) for i in input().split()] for _ in range(N)]

inf = N * 101
dp = [[[inf for _ in range(N*10+11)] for _ in range(N*10+11)] for _ in range(N+1)]

dp[0][0][0] = 0
cmb = itertools.product(range(N), range(N*10), range(N*10))
for i, j, k in cmb:
    dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])
    dp[i+1][j+L[i][0]][k+L[i][1]] = min(dp[i+1][j+L[i][0]][k+L[i][1]], dp[i][j][k] + L[i][2])
ans = inf
for i in range(1, N*10//max(Ma, Mb)):
    ans = min(ans, dp[N][i*Ma][i*Mb])

if ans == inf:
    print(-1)
else:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, Ma, Mb = map(int, input().split())
L = [[int(i) for i in input().split()] for _ in range(N)]

inf = N * 101
dp = [[[inf for _ in range(N*10+11)] for _ in range(N*10+11)] for _ in range(N+1)]

dp[0][0][0] = 0
for i in range(N):
    for j in range(N*10):
        for k in range(N*10):
            dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])
            dp[i+1][j+L[i][0]][k+L[i][1]] = min(dp[i+1][j+L[i][0]][k+L[i][1]], dp[i][j][k] + L[i][2])
ans = inf
for i in range(1, N*10//max(Ma, Mb)):
    ans = min(ans, dp[N][i*Ma][i*Mb])

if ans == inf:
    print(-1)
else:
    print(ans)


Fixed submission:
import itertools
N, Ma, Mb = map(int, input().split())
L = [[int(i) for i in input().split()] for _ in range(N)]

inf = N * 101
dp = [[[inf for _ in range(N*10+11)] for _ in range(N*10+11)] for _ in range(N+1)]

dp[0][0][0] = 0
cmb = itertools.product(range(N), range(N*10), range(N*10))
for i, j, k in cmb:
    dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k])
    dp[i+1][j+L[i][0]][k+L[i][1]] = min(dp[i+1][j+L[i][0]][k+L[i][1]], dp[i][j][k] + L[i][2])
ans = inf
for i in range(1, N*10//max(Ma, Mb)):
    ans = min(ans, dp[N][i*Ma][i*Mb])

if ans == inf:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 11 > 6:
  print(N+10//11*2)
elif n % 11 == 0:
  print(N//11*2)
else:
  print(N//11*2+1)

Fixed submission:
N = int(input())
if N % 11 > 6:
  print((N+10)//11*2)
elif N % 11 == 0:
  print(N//11*2)
else:
  print(N//11*2+1)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = input().split()
L = [a*b, c*d]
L.sort()
print(L[1])

Fixed submission:
a, b, c, d = map(int,input().split())
L = [a*b, c*d]
L.sort()
print(L[1])
Buggy python submission (verdict: Runtime Error):
S = input()
print'A%sC' % s[0]

Fixed submission:
A,S,C = input().split()
print ('A%sC' % S[0])
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
print(K * ((K-1)**(N-1))

Fixed submission:
N, K = map(int, input().split())
print(K * ((K-1) ** (N-1)))
Buggy python submission (verdict: Time Limit Exceeded):
import math
N = int(input())
L = [[int(i) for i in input().split()] for _ in range(N)]
T = 1
A = 1
for l in L:
    t, a = l[0], l[1]
    while(T > t or A > a):
        t += l[0]
        a += l[1]
    else:
        T, A = t, a
print(T+A)


Fixed submission:
from math import ceil
N = int(input())
L = [[int(i) for i in input().split()] for _ in range(N)]
T = 1
A = 1
for l in L:
    k = max((T+l[0]-1)//l[0], (A+l[1]-1)//l[1])
    T = k * l[0]
    A = k * l[1]
print(T+A)
Buggy python submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print((a+b) * (h/2))


Fixed submission:
a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2))
Buggy python submission (verdict: Runtime Error):
S_A = [i for i in input()]
S_B = [i for i in input()]
S_C = [i for i in input()]
T = S_A
l = T.__len__()
while(l > 0):
    if T.pop(0) == 'a':
        T = S_A
    elif T.pop(0) == 'b':
        T = S_B
    else:
        T = S_C
    l = T.__len__()
if 0 == S_A.__len__():
    print("A")
elif 0 == S_B.__len__():
    print("B")
else:
    print("C")


Fixed submission:
S_A = [i for i in input()+'A']
S_B = [i for i in input()+'B']
S_C = [i for i in input()+'C']
T = S_A
l = T.__len__()
while(l > 1):
    t = T.pop(0)
    if t == 'a':
        T = S_A
    elif t == 'b':
        T = S_B
    elif t == 'c':
        T = S_C
    l = T.__len__()
print(T[0])
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
d = [int(i) for i in input().split()]

for i in range(100000):
  m = n + i
  N = []
  while(m > 0):
    N.append(m%10)
    m //= 10
  N.reverse()
  if N.intersection(d) == []:
    print(N)
    exit()
  else:
    continue

Fixed submission:
n, k = map(int, input().split())
d = set([int(i) for i in input().split()])

while True:
  N = set([int(i) for i in str(n)])
  if len(N.intersection(d)) == 0:
    print(n)
    break
  else:
    n += 1
Buggy python submission (verdict: Runtime Error):
str = input()

split = str.split(" ")

N = int(split[0])
M = int(split[1])

HowMuch = [0 for i in range(N)]

split = input().split(" ")
for i in range(N):
  HowMuch[i] = int(split[i])
  
sortHow = HowMuch.sort(reverse = True)

if sortHow is None:
  sortHow = HowMuch[0]

if type(sortHow) is int:
  for i in range(M):
    sortHow //= 2
  print(sortHow)
else:
  for i in range(M):
    maxInd = sortHow.index(max(sortHow))
    sortHow[maxInd] //= 2
  print(sum(HowMuch))

Fixed submission:
str = input()

if str == "Sunny":
  print("Cloudy")
elif str == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
Buggy python submission (verdict: Runtime Error):
str = input()

split = str.split(" ")

Member = int(split[0])
Point = int(split[1])
Ans = int(split[2])
MemPoint = [0 for i in range(Member)]

for i in range(Ans):
  MemPoint[int(input())] += 1

maxNum = max(MemPoint)
for i in range(Menber):
  if maxNum == MemPoint[i]:
    print("Yes")
  else:
    print("No")

Fixed submission:
str = input()

split = str.split(" ")

Member = int(split[0])
Point = int(split[1])
Ans = int(split[2])
MemPoint = [0 for i in range(Member)]

for i in range(Ans):
  MemPoint[int(input())-1] += 1

for i in range(Member):
  if Point - (Ans - MemPoint[i]) > 0:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
  s = input().split(" ")
  R = int(s[0])
  G = int(s[1])
  B = int(s[2])
  N = int(s[3])
  
  count = 0
  for i in range(N/R+1):
    sumR = R * i
    if sumR == N:
      count += 1
      break
    elif sumR > N:
      break
    else:
      for j in range(N/G+1):
        sumG = G * j
        if sumR + sumG == N:
          count += 1
          break
        elif sumR + sumG > N:
          break
        else:
          for k in range(N/B+1):
            sumB = B * k
            if sumR + sumG + sumB == N:
              count += 1
              break
            elif sumR + sumG + sumB > N:
              break
  print(count)

Fixed submission:
import sys

if __name__ == "__main__":
	s = input().split(" ")
	print(int(s[0]) - (int(s[1]) - 1))

Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
  s = input().split(" ")
  R = int(s[0])
  G = int(s[1])
  B = int(s[2])
  N = int(s[3])
  
  count = 0
  for i in range(R):
    sumR = R * i
      for j in range(G):
        sumG = G * j
        for k in range(B):
          sumB = sumB * k
          if sumR + sumG + sumB == N:
            count += 1
            break
  print(count)

Fixed submission:
import sys

if __name__ == "__main__":
	s = input().split(" ")
	print(int(s[0]) - (int(s[1]) - 1))

Buggy python submission (verdict: Runtime Error):
import sys

s = input().split(" ")

print(int(s[0]) - (int(s[1]) - 1)

Fixed submission:
import sys

if __name__ == "__main__":
	s = input().split(" ")
	print(int(s[0]) - (int(s[1]) - 1))
Buggy python submission (verdict: Runtime Error):
#-*- coding: UTF-8 -*-

a = int(input())
s = input()

if a => 3200:
    print(s)

elif:
    print("red")


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

if a >= 3200:
    print(s)

else:
    print("red")

Buggy python submission (verdict: Runtime Error):
a = int(input())
s = input()

if a => 3200:
    print(s)

elif:
    print("red")


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

if a >= 3200:
    print(s)

else:
    print("red")
Buggy python submission (verdict: Runtime Error):
# -*- coding: UTF-8 -*-
import math

n = int(input())
l = []

for i in range(n):
    l.append("".join(sorted(str(input()))))

l.sort()

p = 0
s = 0
f = 0

for i in range(n):
    if l[i] == l[i+1]:
        s =+ 1
        f = 1
    elif l[i] != l[i+1] and f == 1:
        s += 1
        f = 0
        p += math.factorial(s)/(2 * math.factorial(s-2))


print(p)


Fixed submission:
# -*- coding: UTF-8 -*-

n = int(input())
l = []

for i in range(n):
    l.append("".join(sorted(str(input()))))

l.sort()

p = 0
s = 1
f = 0

for i in range(n-1):
    if l[i] == l[i+1] and i != n-2:
        s += 1
        f = 1

    elif l[i] != l[i+1] and f == 1:
        f = 0
        p += int(s * (s-1) / 2)
        s = 1

    elif l[i] == l[i+1] and i == n-2:
        s += 1
        f = 0
        p += int(s * (s-1) / 2)


print(p)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: UTF-8 -*-

n = int(input())
l = []

for i in range(n):
    l.append(sorted(str(input())))

p = 0

for i in range(n):
    for j in range(n - i - 1):
        if l[i] == l[i+j+1]:
            p += 1

print(p)


Fixed submission:
# -*- coding: UTF-8 -*-

n = int(input())
l = []

for i in range(n):
    l.append("".join(sorted(str(input()))))

l.sort()

p = 0
s = 1
f = 0

for i in range(n-1):
    if l[i] == l[i+1] and i != n-2:
        s += 1
        f = 1

    elif l[i] != l[i+1] and f == 1:
        f = 0
        p += int(s * (s-1) / 2)
        s = 1

    elif l[i] == l[i+1] and i == n-2:
        s += 1
        f = 0
        p += int(s * (s-1) / 2)


print(p)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: UTF-8 -*-

n = int(input())
l = []

for i in range(n):
    a = list(str(input()))
    a.sort()
    l.append("".join(a))

p = 0

for i in range(n):
    for j in range(n - i - 1):
        if l[i] == l[i+j+1]:
            p += 1

print(p)


Fixed submission:
# -*- coding: UTF-8 -*-

n = int(input())
l = []

for i in range(n):
    l.append("".join(sorted(str(input()))))

l.sort()

p = 0
s = 1
f = 0

for i in range(n-1):
    if l[i] == l[i+1] and i != n-2:
        s += 1
        f = 1

    elif l[i] != l[i+1] and f == 1:
        f = 0
        p += int(s * (s-1) / 2)
        s = 1

    elif l[i] == l[i+1] and i == n-2:
        s += 1
        f = 0
        p += int(s * (s-1) / 2)


print(p)
Buggy python submission (verdict: Runtime Error):
*- coding: UTF-8 -*-

n = int(input())
l = list(map(int, input().split()))
l.reverse()
f = 0

for i in range(len(l)-1):
    if l[i] >= l[i+1]:
        continue
    else:
        if l[i] >= l[i+1] - 1:
            l[i+1] -= 1
        else:
            f = 1

    if f == 1:
        break


if f == 1:
    print("No")
else:
    print("Yes")


Fixed submission:
# -*- coding: UTF-8 -*-

n = int(input())
l = list(map(int, input().split()))
l.reverse()
f = 0

for i in range(len(l)-1):
    if l[i] >= l[i+1]:
        continue
    else:
        if l[i] >= l[i+1] - 1:
            l[i+1] -= 1
        else:
            f = 1

    if f == 1:
        break

if f == 1:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: UTF-8 -*-

n = int(input())
a = [int(input()) for i in range(n)]

for i in range(n-1):
    l = a[:i] + a[i+1:]
    print(max(l))

print(max(a[:n]))


Fixed submission:
# -*- coding: UTF-8 -*-

n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a,reverse=True)

p = a.index(max(a))

for i in range(n):
    if i == p:
        print(b[1])
    else:
        print(b[0])
Buggy python submission (verdict: Runtime Error):
n=map(int,input())
fact=[1,1,2,6,24,120,720,5040,40320]
p=list(map(int,input().split()))
q=list(map(int,input().split()))
a=0
b=0
for i in range(n):
	a=a+((p[i]-1)*(fact[n-i-1]))
	b=b+((q[i]-1)*(fact[n-i-1]))
	for j in range(i+1,n):
		if(p[j]>p[i]):
			p[j]=p[j]-1
		if(q[j]>q[i]):
			q[j]=q[j]-1
print(abs(a-b))

Fixed submission:
n=int(input())
fact=[1]*13
for i in range(2,13):
	fact[i]=i*fact[i-1]
p=list(map(int,input().split()))
q=list(map(int,input().split()))
a=0
b=0
for i in range(n):
	a=a+((p[i]-1)*(fact[n-i-1]))
	b=b+((q[i]-1)*(fact[n-i-1]))
	for j in range(i+1,n):
		if(p[j]>p[i]):
			p[j]=p[j]-1
		if(q[j]>q[i]):
			q[j]=q[j]-1
print(abs(a-b))
Buggy python submission (verdict: Runtime Error):
s=input()
s[3]='8'
print(s)

Fixed submission:
s=list(input().split('/'))
s[0]="2018"
o=s[0]+'/'+s[1]+'/'+s[2]
print(o)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

# input
n = int(stdin.readline().rstrip())
s = ["".join(sorted(list(str(input()))) ) for _ in range(n)]
"""
for _ in range(n):
    raw = 
    raw.sort()
    s.append("".join(raw))
"""
c = 0
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        if s[i] == s[j]:
            c += 1
print(c)


Fixed submission:
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin
 
def main():
    n = int(input())
    S = ["".join(sorted(input())) for _ in range(n)]

    ans = 0
    dd = defaultdict(int)
    for s in S:
        ans += dd[s]
        dd[s] += 1
    print(ans)
 
input = lambda: stdin.readline().rstrip()
main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

# input
[n] = [int(x) for x in stdin.readline().rstrip().split()]
s = []
for i in range(n):
    raw = list(str(stdin.readline().rstrip()))
    raw.sort()
    s.append("".join(raw))

c = 0
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        if i > j:
            continue
        if s[i] == s[j]:
            c += 1
print(c)


Fixed submission:
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin
 
def main():
    n = int(input())
    S = ["".join(sorted(input())) for _ in range(n)]

    ans = 0
    dd = defaultdict(int)
    for s in S:
        ans += dd[s]
        dd[s] += 1
    print(ans)
 
input = lambda: stdin.readline().rstrip()
main()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

# input
n,m = [int(x) for x in stdin.readline().rstrip().split()]
r = {}
#a = []
#b = []
for i in range(n):
    tmp = [int(x) for x in stdin.readline().rstrip().split()]
    if tmp[0] not in r:
        r[tmp[0]] = []
    r[tmp[0]].append(tmp[1])
    #a.append(tmp[0])
    #b.append(tmp[1])

result = 0
for i in range(m):
    v = 0
    tmp_key = None
    tmp_i = None
    for j in range(i+1):
        l = j+1
        if l in r:
            if max(r[l]) > v:
                tmp_key = l
                tmp_i = r[l].index(max(r[l]))
                v = r[l][tmp_i]
    if tmp_key is not None:
        del r[tmp_key][tmp_i]
        if len(r[tmp_key]) == 0:
            del r[tmp_key]
        result += int(v)

print(result)

Fixed submission:
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin
 
def main():
    n, m = map(int, input().split())
    dd = defaultdict(list)
    for _ in range(n):
        a, b = map(int, input().split())
        dd[a].append(b)
    
    ans = 0
    heap = []
    for i in range(1, m+1):
        if i in dd:
            for v in dd[i]:
                heappush(heap, v*-1)
        if len(heap) > 0:
            ans += -1 * heappop(heap)

    print(ans)
 
input = lambda: stdin.readline().rstrip()
main()
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin
 
def main():
    N = map(int, input().split())
    A = [int(x) for x in input.split()]
    cnt = 0
    while True:
        for i in range(N):
            A[i] /= 2
            if A[i] % 2 == 1:
                break
        cnt += 1
    print(cnt)
 
input = lambda: stdin.readline().rstrip()
main()

Fixed submission:
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin

def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    cnt = 0
    while True:
        loop = True
        for i in range(N):
            if A[i] % 2 == 1:
                loop = False
                break
            A[i] /= 2
        if not loop:
            break
        cnt += 1
    print(cnt)

input = lambda: stdin.readline().rstrip()
main()
Buggy python submission (verdict: Time Limit Exceeded):
from numpy import array
N, K = list(map(int, input().split()))
A = array(list(map(int, input().split())))
div = 1000000007
s = 0
s2 = 0
for i, n in enumerate(A):
    tmp = A < n
    s += int(sum(tmp[i+1:]))
    s2 += int(sum(tmp))

print(((s * K) + (s2 * (K-1) * K // 2)) % div)


Fixed submission:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
div = 1000000007
s = 0
ss = 0

for i, a in enumerate(A):
    for j in range(i+1, N):
        if a > A[j]:
            s += 1

for i in A:
    for j in A:
        if i > j:
            ss += 1

print(((s * K) + (ss * K * (K-1) // 2)) % div)
Buggy python submission (verdict: Runtime Error):
s = input()
dp = [0 for _ in range(13)]
dp[0] = 1
c = 1000000007
m = 1
r13 = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
r10 = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
for i in range(len(s) - 1, -1, -1):
    ndp = [0 for _ in r13]
    if s[i] == "?":
        for j in r10:
            jm = j * m
            for k in r13:
                index = (jm + k) % 13
                ndp[index] = (ndp[index] + dp[k]) % c
    else:
        jm = int(s[i]) * m
        for k in r13:
            index = (jm + k) % 13
            ndp[index] = (ndp[index] + dp[k]) % c
    dp = ndp[:]
    m = m * 10 % 13
print(dp[5])


Fixed submission:
A, B = map(int, input().split())
if (A + B) % 2 != 0:
    print("IMPOSSIBLE")
else:
    print((A + B) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
a = [int(i) for i in input().split()]
zeros = np.zeros(N)
index = np.arange(1, N + 1)
middle = int(N / 2) + 1
 
for i, e in zip(a[::-1], index[::-1]):
    if e >= middle:
        zeros[e - 1] = i
    else:
        if sum(zeros[index % e == 0]) % 2 == i:
            pass
        else:
            zeros[e - 1] = 1
 
M = sum(zeros)
print(int(M))
 
for i, e in zip(zeros, index):
    if i == 1:
        print(e, end=" ")

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
zeros = [0] * N
ai = length = len(a)

for i in a[::-1]:
    s = 0
    for j in range(ai, length+1, ai):
        s += zeros[j-1]
    if s % 2 == i:
        pass
    else:
        zeros[ai-1] = 1
    ai -= 1

print(sum(zeros))
for i, v in enumerate(zeros, 1):
    if v:
        print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
a = [int(i) for i in input().split()]
zeros = np.zeros(N)
index = np.arange(1, N + 1)
middle = int(N / 2) + 1

for i, e in zip(a[::-1], index[::-1]):
    if e >= middle:
        zeros[e - 1] = i
    else:
        if sum(zeros[index % e == 0]) % 2 != i:
            zeros[e - 1] = 1

print(int(sum(zeros)))

for i, e in zip(zeros, index):
    if i == 1:
        print(e, end=" ")


Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
zeros = [0] * N
ai = length = len(a)

for i in a[::-1]:
    s = 0
    for j in range(ai, length+1, ai):
        s += zeros[j-1]
    if s % 2 == i:
        pass
    else:
        zeros[ai-1] = 1
    ai -= 1

print(sum(zeros))
for i, v in enumerate(zeros, 1):
    if v:
        print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
a = [int(i) for i in input().split()]
zeros = np.zeros(N)
index = np.arange(1, N + 1)
middle = int(N / 2) + 1

for i, e in zip(a[::-1], index[::-1]):
    if e >= middle:
        zeros[e - 1] = i
    else:
        if sum(zeros[index % e == 0]) % 2 == i:
            pass
        else:
            zeros[e - 1] = 1

M = sum(zeros)
print(int(M))

for i, e in zip(zeros, index):
    if i == 1:
        print(e, end=" ")


Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
zeros = [0] * N
ai = length = len(a)

for i in a[::-1]:
    s = 0
    for j in range(ai, length+1, ai):
        s += zeros[j-1]
    if s % 2 == i:
        pass
    else:
        zeros[ai-1] = 1
    ai -= 1

print(sum(zeros))
for i, v in enumerate(zeros, 1):
    if v:
        print(i)
Buggy python submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

R = int(input())

print(int(R ** 2))_


Fixed submission:
import sys

input = sys.stdin.readline

R = int(input())

print(int(R ** 2))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = int(input())


def main():

    factorized = factorizer(N)

    if factorized.get(N) is not None:
        print(N - 1)
        quit()

    end = N ** 0.5
    minv = 10000000000
    for i in range(1, int(end)):
        for j in range(i, N):
            # print("i:{0}  j:{1}  i*j:{2}  N:{3}".format(i, j, i * j, N))
            if (i * j) == N:
                minv = min(minv, i + j - 2)

    print(minv)


def factorizer(n):
    """
    素因数分解するということは、
    2 ~ Nまでの数で割り続けるということ　試し割り
    割れなくなったら次の数で割る。
    素数を除いて、素因数の最大値は√nなので、それを超えたらやめる
    """
    res = {1: 1}  # １は必ずある
    calcEnd = n ** 0.5

    for i in range(2, int(calcEnd) + 2, 1):
        while n % i == 0:
            if res.get(i) is None:
                res[i] = 1
            else:
                res[i] += 1
            n /= i
            # print("n:{0}".format(n))

    # GCDが素数だった時の処理
    if n > 1:
        res[int(n)] = 1

    # print("res is {}".format(res))
    return res


if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())


def main():

    end = N ** 0.5
    minv = 10 ** 12
    list = []
    for i in range(1, int(end) + 1):
        if N % i == 0:
            list.append([i, N / i])
    for item in list:
        minv = min(minv, item[0] + item[1] - 2)

    print(int(minv))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
prices = list(map(int, input().split(' ')))
for i in range(M):
    prices[prices.index(max(prices))] //= 2

print(sum(prices))

Fixed submission:
import heapq
N, M = map(int, input().split(' '))
prices = list(map(lambda x: x * (-1), map(int, input().split(' '))))

# 優先度付きキューに変換
heapq.heapify(prices)

for i in range(M):
    # 最大のものを半額にしてまたキューに突っ込む
    heapq.heappush(prices, ((heapq.heappop(prices) * (-1)) // 2) * -1)

print(sum(prices) * -1)

Buggy python submission (verdict: Time Limit Exceeded):
import math
N, M = map(int, input().split())
prices = list(map(int, input().split(' ')))
total = 0
for i in range(M):
    prices.sort(reverse=True)
    prices[0] /= 2

for price in prices:
    total += math.floor(price)
print(total)

Fixed submission:
import heapq
N, M = map(int, input().split(' '))
prices = list(map(lambda x: x * (-1), map(int, input().split(' '))))

# 優先度付きキューに変換
heapq.heapify(prices)

for i in range(M):
    # 最大のものを半額にしてまたキューに突っ込む
    heapq.heappush(prices, ((heapq.heappop(prices) * (-1)) // 2) * -1)

print(sum(prices) * -1)