Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,w = map(int,input().split())
items = [[0,0] for i in range(n+1)]
dp =[[0 for i in range(w+1)] for i in range(n+1)]

for i in range(1, n+1):
  items[i][0],items[i][1] = map(int,input().split())

for i in range(1,n+1):
  for j in range(1,w+1):
    if items[i][0] <= j:
      dp[i][j] = max(dp[i-1][j],dp[i-1][j-items[i][0]]+items[i][1])
    else:
      dp[i][j] = dp[i-1][j]

print(dp[n][w])

Fixed submission:
from collections import defaultdict
n, W = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]

dp = defaultdict(int)
dp[0] = 0
for w, v in wv:
    dp_cur = list(dp.items())
    for w_cur, v_cur in dp_cur:
        if w_cur+w <= W:
            dp[w_cur+w] = max(dp[w_cur+w], v_cur+v)
print(max(dp.values()))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sunuke = 1
for i in range(1, n+1):
  sunuke = sunuke * i

print(sunuke % 1000000007)


Fixed submission:
n = int(input())
sunuke = 1
for i in range(1, n+1):
  sunuke = sunuke * i % 1000000007

print(sunuke)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
A=[input() for i in range(n)]
B=[input() for i in range(m)]

for i in range(n):
  for j in range(n):
    k=j+m
    if k <= n:
      if A[i][j:k]== B[0]:
        o=1
        for l in range(i+1,i+m):
          if A[l][j:k]!=B[o]:
            break
          else:
            o+=1
        if o==m:
          print('Yes')
          exit()
print('No')



Fixed submission:
n,m=map(int,input().split())
A=[input() for i in range(n)]
B=[input() for i in range(m)]

for i in range(n):
  for j in range(n):
    k=j+m
    if k <= n:
      if A[i][j:k]== B[0]:
        o=1
        for l in range(i+1,i+m):
          if l<n:
            if A[l][j:k]!=B[o]:
              break
            else:
              o+=1
        if o==m:
          print('Yes')
          exit()
print('No')
Buggy python submission (verdict: Runtime Error):
print('ABC' if int(input() < 1200 else 'ARC'))

Fixed submission:
print('ABC' if int(input()) < 1200 else 'ARC')
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
count=0

nums=[i for i in range(k+1)]

for i in range(len(nums)):
  for j in range(len(nums)):
    l = s-i-j
    if 0 <= l <=k:
      if i+j+l==s:
        count+=1
print((count))


Fixed submission:
k,s=map(int,input().split())
count=0

nums=[i for i in range(k+1)]

for i in range(len(nums)):
  for j in range(len(nums)):
    if 0 <= s-i-j <= k:
      count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
k,s=map(int,input().split())
count=0

nums=[i for i in range(k+1)]

for i in itertools.product(nums,repeat=3):
  if sum(i)==s:
    count+=1
print(count)



Fixed submission:
k,s=map(int,input().split())
count=0

nums=[i for i in range(k+1)]

for i in range(len(nums)):
  for j in range(len(nums)):
    if 0 <= s-i-j <= k:
      count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())

count = 0
for i in range(a, b+1):
  if i % x == 0:
    count += 1

print(count)


Fixed submission:
a,b,x = map(int, input().split())
print(b//x - (a-1)//x)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input())
a = set([a,b,c])
print(len(a))


Fixed submission:
a,b,c = map(int,input().split())
a = set([a,b,c])
print(len(a))
Buggy python submission (verdict: Runtime Error):
s=input()

gu=0
pa=0
win=0

fot t in s:
  if t=='g':
    if gu>pa:
      pa+=1
      win+=1
    else:
      gu+=1
  else:
    if gu>pa:
      pa+=1
    else:
      win-=1
      gu+=1
print(win)
      
    

Fixed submission:
s=input()

gu=0
pa=0
win=0

for t in s:
  if t=='g':
    if gu>pa:
      pa+=1
      win+=1
    else:
      gu+=1
  else:
    if gu>pa:
      pa+=1
    else:
      win-=1
      gu+=1
print(win)
Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
X=sorted(list(map(int,input().split())))
#x1...xjからk枚選んでxiの合計をsにするような選び方の総数
m=max(a,X[-1])
dp=[[[0 for j in range(m*n+1)] for k in range(n+1)]for s in range(n+1)]

dp[0][0][0]=1
for j in range(n+1):
  for k in range(n+1):
    for s in range(m*n+1):
      if j >=1 and s<X[j-1]:
        dp[j][k][s]=dp[j-1][k][s]
      elif j>=1 and k>=1 and s>=X[j-1]:
        dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-X[j-1]]
ans = 0
for k in range(1, n+1):
  ans += dp[n][k][k*a]
print(ans)

Fixed submission:
from collections import Counter
n,a=map(int,input().split())
X=sorted(list(map(lambda x:int(x)-a,input().split())))
ans=Counter([0])
for x in X:
  tmp=Counter()
  for k,v in ans.items():
    tmp[k+x]+=v
  ans+=tmp
print(ans[0]-1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))
checked = [0]
next_num = a[0]-1
i = 0
while True:
    if i == 0:
        i += 1
    elif next_num in checked:
        loop = checked[checked.index(next_num):]
        break
    checked.append(next_num)
    next_num = a[next_num]-1
dif = len(checked) - len(loop)
if k <= dif:
    print(checked[k]+1)
else:
    k = k-dif
    print(loop[k%len(loop)]+1)

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
checked = [0]
next_num = a[0]-1
check = [0]*n
i = 0
while True:
    if i == 0:
        i += 1
    elif check[next_num] == 1:
        loop = checked[checked.index(next_num):]
        break
    checked.append(next_num)
    check[next_num] = 1
    next_num = a[next_num]-1
dif = len(checked) - len(loop)
if k <= dif:
    print(checked[k]+1)
else:
    k = k-dif
    print(loop[k%len(loop)]+1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
cnt = 0
lim = min(10**9, n)
i = 0
di = 1
while True:
    if i+di >= n:
        i = 0
        di += 1
        if di == lim+1:
            break
    elif a[i+di] + a[i] == di:
        cnt += 1
        i += 1
    else:
        i += 1
print(cnt)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
c=[0]*n
d=0
sums=0
for j in range(n):
    if j-a[j]<1:
        das=0
    else:
        b[j-a[j]]=b[j-a[j]]+1
    if j+a[j]>n-2:
        das=0
    else:
        c[j+a[j]]=c[j+a[j]]+1
for k in range(n):
    d=b[k]*c[k]
    sums=sums+d
print(sums)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        if a[j] + a[i] == j - i:
            cnt += 1
print(cnt)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
c=[0]*n
d=0
sums=0
for j in range(n):
    if j-a[j]<1:
        das=0
    else:
        b[j-a[j]]=b[j-a[j]]+1
    if j+a[j]>n-2:
        das=0
    else:
        c[j+a[j]]=c[j+a[j]]+1
for k in range(n):
    d=b[k]*c[k]
    sums=sums+d
print(sums)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
cnt = 0
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        a = int(s[i:j+1])
        if a % 2019 == 0:
            cnt += 1
print(cnt)

Fixed submission:
P = 2019
S=input()
N = len(S)
ans=0

rem = [0]*P
mod = 0
ten = 1
rem[mod]=1
for i in range(N):
    mod=(mod+int(S[N-i-1])*ten)%P
    ten=ten*10%P
    rem[mod]+=1
for j in rem:
    ans+=(j*(j-1))//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
cnt = 0
for i in range(len(s)-1):
    for j in range(i+1, len(s)):
        a = int(s[i:j+1])
        if a % 2019 == 0:
            cnt += 1
print(cnt)

Fixed submission:
P = 2019
S=input()
N = len(S)
ans=0

rem = [0]*P
mod = 0
ten = 1
rem[mod]=1
for i in range(N):
    mod=(mod+int(S[N-i-1])*ten)%P
    ten=ten*10%P
    rem[mod]+=1
for j in rem:
    ans+=(j*(j-1))//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import functools
from fractions import gcd
k = int(input())
cnt = 0
for i in range(1,k+1):
    for j in range(i,k+1):
        for l in range(j,k+1):
            if i == j and j == l:
                cnt += i
            elif i == j and j != l:
                li = [i,l]
                cnt += functools.reduce(gcd,li)*3
            elif i != j and j == l:
                li = [i,j]
                cnt += functools.reduce(gcd,li)*3
            else:
                li = [i,j,l]
                cnt += functools.reduce(gcd,li)*6
print(cnt)

Fixed submission:
import functools
from math import gcd
k = int(input())
cnt = 0
for i in range(1,k+1):
    for j in range(i,k+1):
        for l in range(j,k+1):
            if i == j and j == l:
                cnt += i
            elif i == j and j != l:
                li = [i,l]
                cnt += functools.reduce(gcd,li)*3
            elif i != j and j == l:
                li = [i,j]
                cnt += functools.reduce(gcd,li)*3
            else:
                li = [i,j,l]
                cnt += functools.reduce(gcd,li)*6
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
from fractions import gcd
k = int(input())
cnt = 0
for i in range(1,k+1):
    for j in range(i,k+1):
        for l in range(j,k+1):
            if i == j and j == l:
                cnt += i
            elif i == j and j != l:
                li = [i,l]
                cnt += functools.reduce(gcd,li)*3
            elif i != j and j == l:
                li = [i,j]
                cnt += functools.reduce(gcd,li)*3
            else:
                li = [i,j,l]
                cnt += functools.reduce(gcd,li)*6
print(cnt)

Fixed submission:
import functools
from math import gcd
k = int(input())
cnt = 0
for i in range(1,k+1):
    for j in range(i,k+1):
        for l in range(j,k+1):
            if i == j and j == l:
                cnt += i
            elif i == j and j != l:
                li = [i,l]
                cnt += functools.reduce(gcd,li)*3
            elif i != j and j == l:
                li = [i,j]
                cnt += functools.reduce(gcd,li)*3
            else:
                li = [i,j,l]
                cnt += functools.reduce(gcd,li)*6
print(cnt)
Buggy python submission (verdict: Runtime Error):
from collections import deque

x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort(reverse=True)
xlis = deque(p[len(p)-x:])
ylis = deque(q[len(q)-y:])
r = deque(r)
while True:
    if len(r) == 0:
        break
    xs = xlis.popleft()
    ys = ylis.popleft()
    rm = r.popleft()
    if rm < xs and rm < ys:
        xlis.append(xs)
        ylis.append(ys)
        break
    if xs < ys and xs < rm:
        xlis.append(rm)
        ylis.append(ys)
    elif ys < xs and ys < rm:
        ylis.append(rm)
        xlis.append(xs)
print(sum(xlis)+sum(ylis))

Fixed submission:
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse = True)
Q = sorted(list(map(int, input().split())), reverse = True)
R = list(map(int, input().split()))

a = sorted(P[:X] + Q[:Y] + R, reverse  = True)
print(sum(a[:(X+Y)]))

Buggy python submission (verdict: Runtime Error):
from collections import deque

x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort(reverse=True)
xlis = deque(p[len(p)-x:])
ylis = deque(q[len(q)-y:])
r = deque(r)
while True:
    xs = xlis.popleft()
    ys = ylis.popleft()
    rm = r.popleft()
    if rm < xs and rm < ys:
        xlis.append(xs)
        ylis.append(ys)
        break
    if xs < ys and xs < rm:
        xlis.append(rm)
        ylis.append(ys)
    elif ys < xs and ys < rm:
        ylis.append(rm)
        xlis.append(xs) 
print(sum(xlis)+sum(ylis))

Fixed submission:
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse = True)
Q = sorted(list(map(int, input().split())), reverse = True)
R = list(map(int, input().split()))

a = sorted(P[:X] + Q[:Y] + R, reverse  = True)
print(sum(a[:(X+Y)]))
Buggy python submission (verdict: Runtime Error):
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")

Fixed submission:
n,m = map(int,input().split())
if n <= 1:
  n = 0
else:
  n = n * (n-1) / 2
if m <= 1:
  m = 0
else:
  m = m * (m-1) / 2
print(int(n+m))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dic = {}
for _ in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
  else:
    dic[s] = 1
max_k_list = [kv[0] for kv in dic.items() if kv[1] == max(dic.values())]
max_k_list = sorted(max_k_list)
for i in max_k_list:
  print(i)

Fixed submission:
N = int(input(''))
dict = {}
for i in range(N):
    S = input('')
    if S in dict:
        dict[S] += 1
    else:
        dict[S] = 1
M = max(dict.values())
out = [j for j in dict.keys() if dict[j] == M]
out.sort()
for k in out:
    print(k)
Buggy python submission (verdict: Time Limit Exceeded):
def expectation(li):
  total = 0
  for i in li:
    total += (i+1)/2
  return total

n,k = map(int,input().split())
p = list(map(int,input().split()))
M = 0
for i in range(n-k+1):
  li = p[i:i+k]
  total = expectation(li)
  if total > M:
    M = total
print(M)


Fixed submission:
def expectation(li):
  total = 0
  for i in li:
    total += (i+1)/2
  return total

n,k = map(int,input().split())
p = list(map(int,input().split()))
ex = expectation(p[0:k])
li = [ex]
for i in range(1,n-k+1):
  ex = ex - (p[i-1]+1)/2 + (p[i+k-1]+1)/2
  li.append(ex)
print(max(li))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = sorted(list(map(int,input().split())), reverse=True)
if k >= n:
  print(0)
else:
  for i in range(k):
    h.pop(0)
  print(sum(h))

Fixed submission:
n,k = map(int,input().split())
h = sorted(list(map(int,input().split())), reverse=True)
if k >= n:
  print(0)
else:
  del h[:k]
  print(sum(h))

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = sorted(list(map(int,input().split())), reverse=True)
if k >= n:
  print(0)
else:
  for i in range(k):
    h.pop(0)
  print(sum(h))

Fixed submission:
n,k = map(int,input().split())
h = sorted(list(map(int,input().split())), reverse=True)
if k >= n:
  print(0)
else:
  del h[:k]
  print(sum(h))

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = sorted(list(map(int,input().split())), reverse=True)
for i in range(k):
  try:
    h.pop(0)
  except IndexError:
    break
print(sum(h))

Fixed submission:
n,k = map(int,input().split())
h = sorted(list(map(int,input().split())), reverse=True)
if k >= n:
  print(0)
else:
  del h[:k]
  print(sum(h))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range(n):
  m = min(p[0:i+1])
  if m >= p[i]:
    cnt += 1
print(cnt)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
cnt = 0
m = p[0]
for i in range(n):
  if m >= p[i]:
    cnt += 1
    m = p[i]
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
N = int(n * 0.5)
total = n-1
for i in range(1,N):
    if n % i == 0:
        total_ = i + n / i - 2
    if total_ < total:
        total = total_
print(int(total))

Fixed submission:
import math
n = int(input())
m = int(math.sqrt(n))
while n % m != 0:
  m -= 1
print(n//m + m -2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
N = int(n * 0.5)
total = n-1
for i in range(1,N):
    if n % i == 0:
        total_ = i + n / i - 2
    if total_ < total:
        total = total_
print(int(total))

Fixed submission:
import math
n = int(input())
m = int(math.sqrt(n))
while n % m != 0:
  m -= 1
print(n//m + m -2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
li2 = sorted(li,reverse=True)
cnt = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        if li2[i] > li2[j] + li2[j+1]:
            break
        else:
            for k in range(j+1,n):
                if li2[i] < li2[j]+li2[k]:
                    cnt += 1
                else:
                    break
print(cnt)

Fixed submission:
import bisect

n = int(input())
li = list(map(int,input().split()))
li2 = sorted(li)
cnt = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        cnt += bisect.bisect_left(li2,li2[i]+li2[j]) - (j+1) 
print(cnt)

Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
li2 = sorted(li,reverse=True)
cnt = 0

for i in range(n):
    for j in range(i+1,n):
        if li2[i] > li2[j] + li2[j+1]:
            break
        else:
            for k in range(j+1,n):
                if li2[i] < li2[j]+li2[k]:
                    cnt += 1
                else:
                    break
print(cnt)

Fixed submission:
import bisect

n = int(input())
li = list(map(int,input().split()))
li2 = sorted(li)
cnt = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        cnt += bisect.bisect_left(li2,li2[i]+li2[j]) - (j+1) 
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
li2 = sorted(li,reverse=True)
cnt = 0

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if li2[i] < li2[j]+li2[k]:
                cnt += 1
            else:
                break
print(cnt)

Fixed submission:
import bisect

n = int(input())
li = list(map(int,input().split()))
li2 = sorted(li)
cnt = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        cnt += bisect.bisect_left(li2,li2[i]+li2[j]) - (j+1) 
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
cnt = 0

def triangle(a,b,c):
    if (a < b+c) & (b < a+c) & (c < a+b):
        return True
    else:
        return False

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if triangle(li[i],li[j],li[k]):
                cnt += 1
print(cnt)

Fixed submission:
import bisect

n = int(input())
li = list(map(int,input().split()))
li2 = sorted(li)
cnt = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        cnt += bisect.bisect_left(li2,li2[i]+li2[j]) - (j+1) 
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
li2 = sorted(li)
for i in range(n):
    print(li.index(i+1) + 1, end = " ")

Fixed submission:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
  
x = np.argsort(a)
for i in range(n):
  print(x[i]+1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
li2 = []
for i in range(n):
    a = li.index(i+1)
    li2.append(str(a + 1))
print(' '.join(li2))

Fixed submission:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
  
x = np.argsort(a)
for i in range(n):
  print(x[i]+1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
li2 = []
for i in range(n):
    a = li.index(i+1)
    li2.append(str(a + 1))
print(' '.join(li2))

Fixed submission:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
  
x = np.argsort(a)
for i in range(n):
  print(x[i]+1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
li2 = []
for i in range(n):
    a = li.index(i+1)
    li2.append(a + 1)
for i in range(n):
  print(li2[i], end = " ")

Fixed submission:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
  
x = np.argsort(a)
for i in range(n):
  print(x[i]+1)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
if a == 1 or b == 1:
  print(1)
else:
  print(len(set(factorization(a)) & set(factorization(b))) + 1)

Fixed submission:
from fractions import gcd

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr
  
a = factorization(a)
b = factorization(b)
if (len(a)==1 and a[0] == 1) or (len(b)==1 and b[0] == 1):
  print(1)
else:
  print(len(set(a) & set(b)) + 1)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

print(len(set(factorization(a)) & set(factorization(b))) + 1)

Fixed submission:
from fractions import gcd

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr
  
a = factorization(a)
b = factorization(b)
if (len(a)==1 and a[0] == 1) or (len(b)==1 and b[0] == 1):
  print(1)
else:
  print(len(set(a) & set(b)) + 1)

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

MinNum = 1
MaxNum = gcd(a,b)
PrimeNum_list = []

CheckNum = 0
for i in range(MinNum,MaxNum):
    for j in range(2,i+1):
        if i%j==0: CheckNum+=1
        if CheckNum == 2: break

    if CheckNum == 1 and MaxNum % i == 0:
        PrimeNum_list.append(i)
    CheckNum = 0

print(len(PrimeNum_list)+1)

Fixed submission:
from fractions import gcd

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr
  
a = factorization(a)
b = factorization(b)
if (len(a)==1 and a[0] == 1) or (len(b)==1 and b[0] == 1):
  print(1)
else:
  print(len(set(a) & set(b)) + 1)
Buggy python submission (verdict: Runtime Error):
n,k,q = map(int,input().split())
li = [k-q] * n
numli = [int(input()) for i in range(q)]
for a in numli:
    li[a-1] += 1
for i in li:
    if i > 0
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q = map(int,input().split())
li = [k-q] * n
numli = [int(input()) for i in range(q)]
for a in numli:
    li[a-1] += 1
for i in li:
    if i > 0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
li = []
for i in range(q):
    li.append(int(input()))
for i in range(n):
    if k - q + li.count(i+1) > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q = map(int,input().split())
li = [k-q] * n
numli = [int(input()) for i in range(q)]
for a in numli:
    li[a-1] += 1
for i in li:
    if i > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
import heapq

n,m = map(int,input().split())
li = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(li)
for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(a))

Fixed submission:
import heapq

n,m = map(int,input().split())
li = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(li)
for _ in range(m):
    tmp_min = heapq.heappop(li)
    heapq.heappush(li, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(li))