Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n)]
for i in aList:
    num[i] += 1
num.sort()
num = num[:-k]
print(sum(num))


Fixed submission:
n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n + 1)]
for i in aList:
    num[i] += 1
num.sort()
num = num[:-k]
print(sum(num))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n + 1)]
for i in range(n + 1):
    if i in aList:
        num[i] += aList.count(i)
num.sort()
num = num[:-k]
print(sum(num))


Fixed submission:
n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n + 1)]
for i in aList:
    num[i] += 1
num.sort()
num = num[:-k]
print(sum(num))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
aList = list(map(int, input().split()))
aSet = set(aList)
aCount = [aList.count(i) for i in aSet]
aCount.sort()
aCount = aCount[:-k]
print(sum(aCount))


Fixed submission:
n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n + 1)]
for i in aList:
    num[i] += 1
num.sort()
num = num[:-k]
print(sum(num))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
aList = list(map(int, input().split()))
aSet = set(aList)
aCount = [aList.count(i) for i in aSet]
aCount.sort()
aCount = aCount[:-k]
print(sum(aCount))


Fixed submission:
n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n + 1)]
for i in aList:
    num[i] += 1
num.sort()
num = num[:-k]
print(sum(num))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
aList = list(map(int, input().split()))
aSet = set(aList)
aCount = []
for i in aSet:
    aCount.append(aList.count(i))
aCount.sort()
aCount = aCount[:-k]
print(sum(aCount))


Fixed submission:
n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n + 1)]
for i in aList:
    num[i] += 1
num.sort()
num = num[:-k]
print(sum(num))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
aList = list(map(int, input().split()))
aSet = set(aList)
aCount = []
for i in aSet:
    aCount.append(aList.count(i))
aCount.sort()
aCount = aCount[:-k]
print(sum(aCount))


Fixed submission:
n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n + 1)]
for i in aList:
    num[i] += 1
num.sort()
num = num[:-k]
print(sum(num))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
aList = list(map(int, input().split()))
ans = 0
for x in range(10 ** 5):
    num = aList.count(x - 1) + aList.count(x) + aList.count(x + 1)
    if ans < num:
        ans = num
print(ans)

Fixed submission:
import collections

n = int(input())
aList = list(map(int, input().split()))
num = collections.Counter(aList)
ans = 0
for x in range(10 ** 5):
    count = num[x - 1] + num[x] + num[x + 1]
    if ans < count:
        ans = count
print(ans)
Buggy python submission (verdict: Runtime Error):
r, g, b = map(int, input(),split())
if g*10 + b % 4 == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
r, g, b = map(int, input().split())
if (g*10 + b)% 4 == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0
for x in range(k+1):
    for y in range(x, k+1):
        for z in range(y, k+1):
            if x + y + z == s:
                if x == y == z:
                    count += 1
                elif x != y and y != z and z != x:
                    count += 6
                else:
                    count += 3
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for x in range(k+1):
    for y in range(k+1):
        if s-k <= x + y <= s:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                count += 1
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for x in range(k+1):
    for y in range(k+1):
        if s-k <= x + y <= s:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
X = int(input())
for A in range(-150, 150):
    for B in range(-150, 150):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break

Fixed submission:
S = input()

if S == "ARC":
    print("ABC")
else:
    print("ARC")
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
for A in range(-2500, 2500):
    for B in range(-2500, 2500):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break

Fixed submission:
X = int(input())
for A in range(-200, 200):
    for B in range(-200, 200):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break

Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
for A in range(-5000, 5000):
    for B in range(-5000, 5000):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break

Fixed submission:
X = int(input())
for A in range(-200, 200):
    for B in range(-200, 200):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break

Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
for A in range(-10000, 10000):
    for B in range(-10000, 10000):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break

Fixed submission:
X = int(input())
for A in range(-200, 200):
    for B in range(-200, 200):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

count = 1; Pj = [P[0]]
for i in range(1, N):
    if min(Pj) > P[i]:
        count += 1
    Pj.append(P[i])

print(count)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))

count = 0; min = N
for i in range(N):
    if min >= P[i]:
        count += 1
        min = P[i]

print(count)
Buggy python submission (verdict: Runtime Error):
import math

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

print((A*B)//math.gcd(A, B))

Fixed submission:
A, B = map(int, input().split())

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

print((A*B)//gcd(A, B))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []; count = 0
for i in range(N):
    spell = ''.join(sorted(input()))
    if spell in s:
        count += int(s.count(spell))
    s.append(spell)

print(count)

Fixed submission:
N = int(input())
dic = {}
for i in range(N):
    spell = ''.join(sorted(input()))
    if spell in dic.keys():
        dic[spell] += 1
    else:
        dic[spell] = 1

count = 0
for num in dic.values():
    count += sum([i for i in range(num)])

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []; count = 0
for i in range(N):
    spell = ''.join(sorted(input()))
    for j in range(len(s)):
        if spell == s[j]:
            count += 1
    s.append(spell)

print(count)

Fixed submission:
N = int(input())
dic = {}
for i in range(N):
    spell = ''.join(sorted(input()))
    if spell in dic.keys():
        dic[spell] += 1
    else:
        dic[spell] = 1

count = 0
for num in dic.values():
    count += sum([i for i in range(num)])

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
for i in range(N):
    s.append(''.join(sorted(input())))

count = 0
for i in range(N):
    for j in range(i+1, N):
        if s[i] == s[j]:
            count += 1

print(count)

Fixed submission:
N = int(input())
dic = {}
for i in range(N):
    spell = ''.join(sorted(input()))
    if spell in dic.keys():
        dic[spell] += 1
    else:
        dic[spell] = 1

count = 0
for num in dic.values():
    count += sum([i for i in range(num)])

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

def F(A, B):
    return max(len(str(A)), len(str(B)))

ans = 1000000000
for A in range(1, N+1):
    if N%A == 0:
        B = int(N / A)
        if F(A, B) < ans:
            ans = F(A, B)

print(ans)

Fixed submission:
N = int(input())

def F(A, B):
    return max(len(str(A)), len(str(B)))

ans = 1000000000
half = int((N+1)**(1/2) + 1)
for A in range(1, half):
    if N%A == 0:
        B = int(N / A)
        if F(A, B) < ans:
            ans = F(A, B)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
S = list(reversed(input()))
size = len(S)
ans = 0
d = [-1]*(size)#余りを格納

def cnt(num):
  c = collections.Counter(d)
  return c[num]
  
for i in range(size):
  s = ''.join(reversed(S[:i+1]))
  md = int(s) % 2019
  if md == 0:#その数自身が割り切れた場合
    ans+=1
  ans += cnt(md)
  d[i] = md

print(ans)
  
  

Fixed submission:
S = input()
size = len(S)
ans = 0
d = [0]*2019
pre = ''
ln = 0
v = 1
  
for i in range(1,size+1):
  md = (ln +(int(S[-1*i])*v))%2019
  d[md] += 1
  ln = md
  v *= 10
  v %= 2019

d[0] += 1
for i in range(2019):
  ans += d[i]*(d[i]-1)/2 #1~(n-1)までの和

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
S = list(reversed(input()))
size = len(S)
ans = 0
d = [-1]*(size)#余りを格納

def cnt(num):
  return d.count(num)
  
for i in range(size):
  s = ''.join(reversed(S[:i+1]))
  md = int(s) % 2019
  if md == 0:#その数自身が割り切れた場合
    ans+=1
  ans += cnt(md)
  d[i] = md

print(ans)
  
  

Fixed submission:
S = input()
size = len(S)
ans = 0
d = [0]*2019
pre = ''
ln = 0
v = 1
  
for i in range(1,size+1):
  md = (ln +(int(S[-1*i])*v))%2019
  d[md] += 1
  ln = md
  v *= 10
  v %= 2019

d[0] += 1
for i in range(2019):
  ans += d[i]*(d[i]-1)/2 #1~(n-1)までの和

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
size = len(S)
ans = 0#[]
def check(target):
  if int(target) % 2019 == 0:
    return True
  else:
    return False
  
for i in range(size-3):
  for j in range(4,size+1):
    if i+j > size:
      continue
    t = S[i:i+j]
    if check(t):
      ans += 1
      #ans.append((i+1,i+j))
print(ans)

Fixed submission:
S = input()
size = len(S)
ans = 0
d = [0]*2019
pre = ''
ln = 0
v = 1
  
for i in range(1,size+1):
  md = (ln +(int(S[-1*i])*v))%2019
  d[md] += 1
  ln = md
  v *= 10
  v %= 2019

d[0] += 1
for i in range(2019):
  ans += d[i]*(d[i]-1)/2 #1~(n-1)までの和

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
size = len(S)
ans = 0#[]
def check(target):
  if int(target) % 2019 == 0:
    return True
  else:
    return False
  
for i in range(size-3):
  for j in range(4,size+1):
    if i+j > size:
      continue
    t = S[i:i+j]
    if check(t):
      ans += 1
      #ans.append((i+1,i+j))
print(ans)

Fixed submission:
S = input()
size = len(S)
ans = 0
d = [0]*2019
pre = ''
ln = 0
v = 1
  
for i in range(1,size+1):
  md = (ln +(int(S[-1*i])*v))%2019
  d[md] += 1
  ln = md
  v *= 10
  v %= 2019

d[0] += 1
for i in range(2019):
  ans += d[i]*(d[i]-1)/2 #1~(n-1)までの和

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
  return reduce(math.gcd, numbers)

k = int(input())
ans = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      ans += gcd(a,b,c)
print(ans)

Fixed submission:
def gcd(a, b):
  while b:
    a, b = b, a % b
  return a

k = int(input())
ans = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      ans += gcd(gcd(a,b),c)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = input()
R,G,B = [],[],[]
ans = 0

for i in range(len(S)):
  if S[i] == 'R':
    R.append(i+1)
  elif S[i] == 'G':
    G.append(i+1)
  else:
    B.append(i+1)

for r in R:
  for g in G:
    for b in B:
      a,b,c = sorted([r,g,b])
      if b-a != c-b:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
S = input()
r = S.count('R')
g = S.count('G')
b = S.count('B')
cnt = 0

for i in range(n):
  for j in range(i+1,n):
	# j-i == k-j <=> k == 2j-i
    k = 2*j-i
    if k >= n or k <= j:
      break
    if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
      cnt += 1
print(r*g*b - cnt)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
q = int(input())
sw = 1
for i in range(q):
  e = list(input().split())
  t = int(e[0])

  if t == 1:
    sw = sw * -1
  elif t == 2:
    f = int(e[1])
    if (sw == 1 and f == 1) or (sw == -1 and f == 2):
      S = e[2] + S
    elif (sw == -1 and f == 1) or (sw == 1 and f == 2):
      S = S + e[2]

if sw == -1:
  S = S[::-1]

print(S)

Fixed submission:
S=input()
Q=int(input())
L=list()
B=True
X=''
Y=''
for i in range(Q):
  L=list(input().split())
  if L[0]=='1':
    B=not(B)
  else:
    if ((L[1]=='1' and B) or (not(L[1]=='1' or B))):
      Y=Y+L[2]
    else:
      X=X+L[2]
S=S[::-1]
S=S+Y
S=S[::-1]
S=S+X
if not(B):
  S=S[::-1]
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
q = int(input())
sw = 1
for i in range(q):
  e = list(map(str, input().split()))
  t = int(e[0])

  if t == 1:
    sw = sw * -1
  elif t == 2:
    f = int(e[1])
    if (sw == 1 and f == 1) or (sw == -1 and f == 2):
      S = e[2] + S
    elif (sw == -1 and f == 1) or (sw == 1 and f == 2):
      S = S + e[2]

if sw == -1:
  S = S[::-1]

print(S)

Fixed submission:
S=input()
Q=int(input())
L=list()
B=True
X=''
Y=''
for i in range(Q):
  L=list(input().split())
  if L[0]=='1':
    B=not(B)
  else:
    if ((L[1]=='1' and B) or (not(L[1]=='1' or B))):
      Y=Y+L[2]
    else:
      X=X+L[2]
S=S[::-1]
S=S+Y
S=S[::-1]
S=S+X
if not(B):
  S=S[::-1]
print(S)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
q = int(input())
Q = []
sw = 1
for i in range(q):
  e = list(map(str, input().split()))
  Q.append(e)
  t = int(e[0])

  if t == 1:
    sw = sw * -1
  elif t == 2:
    f = int(e[1])
    if (sw == 1 and f == 1) or (sw == -1 and f == 2):
      S = e[2] + S
    elif (sw == -1 and f == 1) or (sw == 1 and f == 2):
      S = S + e[2]

if sw == -1:
  S = S[::-1]

print(S)

Fixed submission:
S=input()
Q=int(input())
L=list()
B=True
X=''
Y=''
for i in range(Q):
  L=list(input().split())
  if L[0]=='1':
    B=not(B)
  else:
    if ((L[1]=='1' and B) or (not(L[1]=='1' or B))):
      Y=Y+L[2]
    else:
      X=X+L[2]
S=S[::-1]
S=S+Y
S=S[::-1]
S=S+X
if not(B):
  S=S[::-1]
print(S)
Buggy python submission (verdict: Runtime Error):
import sys
n, m = map(int, input().split())
S,C=[],[]

for _ in range(m):
  s,c=map(int,input().split())
  S.append(s)
  C.append(c)
cur = 0
for i in range(10**(n-1)-1, 10**n):
  isOk = True
  for j in range(m):
    if str(i)[S[j]-1] != str(C[j]):
      isOk = False
  if isOk:
    print(i)
    sys.exit()
print(-1)

Fixed submission:
n,m = map(int,input().split())
 
sc=[list(map(int,input().split())) for _ in range(m)]
 
def main():
  for i in range(10**n):
    scstr = str(i)
    f = True
    if len(scstr) == n:
      for j in range(m):
        if scstr[sc[j][0]-1] != str(sc[j][1]):
          f = False
      if f:
        print(i)
        return
  print('-1')
 
main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n, k = map(int, input().split())
H = list(map(int, input().split()))

H = sorted(H, reverse=True)
if k >= n:
  print(0)
  sys.exit()
for i in range(k):    
  H.pop(0)
cnt = 0
for h in H:
  cnt += h
print(cnt)


Fixed submission:
import sys
n, k = map(int, input().split())
H = list(map(int, input().split()))

H = sorted(H)
if k >= n:
  print(0)
  sys.exit()

cnt = 0
for i in range(n-k):
  cnt += H[i]
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
P = list(map(int, input().split()))
ans = 0

for i in range(n):
  if min(P[:i+1]) == P[i]:
    ans += 1
print(ans)

Fixed submission:
n = int(input())
P = list(map(int, input().split()))
ans = 0
min = n+1

for i in range(n):
  if P[i] < min:
    min = P[i]
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
l = A.pop(0)
r = A.pop(-1)

for i in range(n-2):
  if r<l:
    r+=A.pop(-1)
  else:
    l+=A.pop(0)
  
print(abs(r-l))

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
l = A.pop(0)
idxl = 0
r = A.pop(-1)
idxr = -1

for i in range(n-2):
  if r<l:
    r+=A[idxr]
    idxr -= 1
  else:
    l+=A[idxl]
    idxl += 1
  
print(abs(r-l))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
l = A.pop(0)
r = A.pop(-1)

for i in range(n-2):
  if r<l:
    r+=A.pop(-1)
  else:
    l+=A.pop(0)
  
print(abs(r-l))

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
l = A.pop(0)
idxl = 0
r = A.pop(-1)
idxr = -1

for i in range(n-2):
  if r<l:
    r+=A[idxr]
    idxr -= 1
  else:
    l+=A[idxl]
    idxl += 1
  
print(abs(r-l))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
l = A.pop(0)
r = A.pop(-1)
while len(A)>0:
  if r<l:
    r+=A.pop(-1)
  else:
    l+=A.pop(0)
print(abs(r-l))

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
l = A.pop(0)
idxl = 0
r = A.pop(-1)
idxr = -1

for i in range(n-2):
  if r<l:
    r+=A[idxr]
    idxr -= 1
  else:
    l+=A[idxl]
    idxl += 1
  
print(abs(r-l))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L = sorted(list(map(int, input().split())))
def isOK(target,a,b):
  return target < a+b

def bin_search(a,b):
  left = 1
  right = n
  while abs(right-left)>1:
    mid = (left+right)//2
    if isOK(L[mid],a,b):
      left = mid
    else:
      right = mid
  return left
ans = 0
for i in range(n-2):
  for j in range(i+1,n):
    a,b = L[i],L[j]
    ans += max(0, bin_search(a,b) - j)
      
print(ans)



Fixed submission:
n = int(input())
L = sorted(list(map(int, input().split())))
def isOK(target,a,b):
  return target < a+b

def bin_search(a,b):
  left = 1
  right = n
  while abs(right-left)>1:
    mid = (left+right)//2
    if isOK(L[mid],a,b):
      left = mid
    else:
      right = mid
  return left
ans = 0
for i in range(n-2):
  for j in range(i+1,n):
    a,b = L[i],L[j]
    ans += max(0, bin_search(a,b) - j)
      
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L = sorted(list(map(int, input().split())))
def isOK(target,a,b):
  return target > abs(a-b) and target < a+b

def bin_search(a,b):
  left = 1
  right = n
  while right-left>1:
    mid = left+(right-left)//2
    if isOK(L[mid],a,b):
      left = mid
    else:
      right = mid
  return left
ans = 0
for i in range(n):
  for j in range(i+1,n):
    a,b = L[i],L[j]
    ans += max(0, bin_search(a,b) - j)
      
print(ans)



Fixed submission:
n = int(input())
L = sorted(list(map(int, input().split())))
def isOK(target,a,b):
  return target < a+b

def bin_search(a,b):
  left = 1
  right = n
  while abs(right-left)>1:
    mid = (left+right)//2
    if isOK(L[mid],a,b):
      left = mid
    else:
      right = mid
  return left
ans = 0
for i in range(n-2):
  for j in range(i+1,n):
    a,b = L[i],L[j]
    ans += max(0, bin_search(a,b) - j)
      
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L = sorted(list(map(int, input().split())))
def isOK(target,a,b):
  return target > abs(a-b) and target < a+b

def bin_search(a,b):
  left = 1
  right = n
  while right-left>1:
    mid = (left+right)//2
    if isOK(L[mid],a,b):
      left = mid
    else:
      right = mid
  return left
ans = 0
for i in range(n):
  for j in range(i+1,n):
    a,b = L[i],L[j]
    ans += max(0, bin_search(a,b) - j)
      
print(ans)


Fixed submission:
n = int(input())
L = sorted(list(map(int, input().split())))
def isOK(target,a,b):
  return target < a+b

def bin_search(a,b):
  left = 1
  right = n
  while abs(right-left)>1:
    mid = (left+right)//2
    if isOK(L[mid],a,b):
      left = mid
    else:
      right = mid
  return left
ans = 0
for i in range(n-2):
  for j in range(i+1,n):
    a,b = L[i],L[j]
    ans += max(0, bin_search(a,b) - j)
      
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
#return arr
def cf(x1,x2):
    cf=[1]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

a, b = map(int, input().split())
cf_list = cf(a,b)

if not 2 in cf_list:
  print(1)
  sys.exit()
ans = [2]
for i in range(1, len(cf_list)):
  flg = True
  for a in ans:
    if cf_list[i] % a == 0:
      flg = False
      break
  if flg:
    ans.append(cf_list[i])
print(len(ans)+1)

Fixed submission:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
a, b = map(int, input().split())
a_list = prime_factorize(a)
b_list = prime_factorize(b)
a_set = set(a_list)
b_set = set(b_list)

ans_set = a_set & b_set
ans_set.add(1)
print(len(ans_set))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd as bltin_gcd
#return arr
def cf(x1,x2):
    cf=[1]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def coprime(a, b):
    return bltin_gcd(a, b) == 1
def rmdb(n, li):
  lst = [x for x in li if x%n != 0]
  return lst

a, b = map(int, input().split())
cf_list = cf(a,b)

ng_set = set()
for i in range(1, len(cf_list)):
  for j in range(1, i):
    if cf_list[i] % cf_list[j] == 0:
      ng_set.add(cf_list[i])
      break
  
print(len(cf_list)-len(ng_set))


Fixed submission:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
a, b = map(int, input().split())
a_list = prime_factorize(a)
b_list = prime_factorize(b)
a_set = set(a_list)
b_set = set(b_list)

ans_set = a_set & b_set
ans_set.add(1)
print(len(ans_set))
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n, m = map(int, input().split())
A = list(map(lambda x: int(x)*-1, input().split()))

for i in range(m):
  heapq.heapify(A)
  max_elm = heapq.heappop(A)*-1 //2
  heapq.heappush(A, max_elm*-1)

print(sum(A)*-1)

Fixed submission:
import heapq
n, m = map(int, input().split())
A = list(map(lambda x: int(x)*-1, input().split()))
heapq.heapify(A)

for i in range(m):
  max_elm = heapq.heappop(A)*-1 //2
  heapq.heappush(A, max_elm*-1)

print(sum(A)*-1)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n, m = map(int, input().split())
A = list(map(lambda x: int(x)*-1, input().split()))

for i in range(m):
  heapq.heapify(A)
  max_elm = heapq.heappop(A)*-1 //2
  heapq.heappush(A, max_elm*-1)

ans = 0
for a in A:
  ans += a*-1
print(ans)

Fixed submission:
import heapq
n, m = map(int, input().split())
A = list(map(lambda x: int(x)*-1, input().split()))
heapq.heapify(A)

for i in range(m):
  max_elm = heapq.heappop(A)*-1 //2
  heapq.heappush(A, max_elm*-1)

print(sum(A)*-1)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n, m = map(int, input().split())
A = list(map(lambda x: int(x)*-1, input().split()))

for i in range(m):
  heapq.heapify(A)
  max_elm = heapq.heappop(A)*-1 //2
  heapq.heappush(A, max_elm*-1)

ans = 0
for a in A:
  ans += a*-1
print(ans)

Fixed submission:
import heapq
n, m = map(int, input().split())
A = list(map(lambda x: int(x)*-1, input().split()))
heapq.heapify(A)

for i in range(m):
  max_elm = heapq.heappop(A)*-1 //2
  heapq.heappush(A, max_elm*-1)

print(sum(A)*-1)