Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02854 (python)

Fixed submission:
import bisect


def CumulativeSum(l):
    a = [0]
    for i in l:
        a.append(a[-1] + i)
    return a[1:]


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = CumulativeSum(a)
    s = b[-1]
    h = s // 2
    x = bisect.bisect_left(b, h)
    try:
        m = (b[x], b[x + 1], b[x - 1])
    except:
        m = (b[x], b[x - 1])
    if s % 2 == 0 and h in m:
        print(0)
        return

    print(min([abs(x * 2 - s) for x in m]))


if __name__ == '__main__':
    resolve()

Buggy submission (verdict: Runtime Error):
import bisect


def CumulativeSum(l):
    a = [0]
    for i in l:
        a.append(a[-1] + i)
    return a[1:]


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = CumulativeSum(a)
    s = b[-1]
    h = s // 2
    x = bisect.bisect_left(b, h)
    try:
        m = (b[x], b[x + 1], b[x - 1])
    except:
        m = (b[x])
    if s % 2 == 0 and h in m:
        print(0)
        return

    print(min([abs(x * 2 - s) for x in m]))


if __name__ == '__main__':
    resolve()

Buggy submission (verdict: Runtime Error):
import bisect


def CumulativeSum(l):
    a = [0]
    for i in l:
        a.append(a[-1] + i)
    return a[1:]


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = CumulativeSum(a)
    s = b[-1]
    h = s // 2
    x = bisect.bisect_left(b, h)
    if x != len(a):
        m = (b[x], b[x + 1], b[x - 1])
    else:
        m = (b[x], b[x - 1])
    if s % 2 == 0 and h in m:
        print(0)
        return

    print(min([abs(x * 2 - s) for x in m]))


if __name__ == '__main__':
    resolve()

Buggy submission (verdict: Runtime Error):
import bisect


def CumulativeSum(l):
    a = [0]
    for i in l:
        a.append(a[-1] + i)
    return a[1:]


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = CumulativeSum(a)
    s = b[-1]
    h = s // 2
    x = bisect.bisect_left(b, h)
    m1, m2 = b[x], b[x + 1]
    if s % 2 == 0 and h in (m1, m2):
        print(0)
        return
    a = []
    for (i, j) in ((m1, x), (m2, x + 1)):
        t = 0
        n = s
        while True:
            if i * 2 == n:
                a.append(t)
                break
            t += 1
            if i * 2 < n:
                i += 1
                n += 1
            elif j < i:
                i -= 1
                n -= 1
            else:
                n += 1
    print(min(a))


if __name__ == '__main__':
    resolve()

Buggy submission (verdict: Runtime Error):
import bisect


def CumulativeSum(l):
    a = [0]
    for i in l:
        a.append(a[-1] + i)
    return a[1:]


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = CumulativeSum(a)
    s = b[-1]
    h = s // 2
    x = bisect.bisect_left(b, h)
    m1, m2 = b[x], b[x + 1]
    if s % 2 == 0 and h in (m1, m2):
        print(0)
        return
    a1 = abs(m1 * 2 - s)
    a2 = abs(m2 * 2 - s)
    print(min(a1, a2))


if __name__ == '__main__':
    resolve()
Problem p02886 (python)

Fixed submission:
from itertools import combinations
_=input()
d=list(map(int,input().split()))
print(sum([i*j for (i,j) in combinations(d,2)]))

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
s=sum(d)
print(sum([x*(d-x) for x in d])//2)
Problem p02947 (python)

Fixed submission:
def main():
    n = int(input())
    s = [""] * n
    ans = 0
    for i in range(n):
        s[i] = SortString(input())
    sDictionary = {}
    for i in range(n):
        if sDictionary.get(s[i]):
            ans += sDictionary.get(s[i])
            sDictionary[s[i]] += 1
        else:
            sDictionary[s[i]] = 1
    print(ans)


def SortString(text):
    return "".join(sorted(list(text)))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
    def main():
        n = int(input())
        s = [""] * n
        ans = 0
        for i in range(n):
            s[i] = SortString(input())
        s.sort()
        for i in range(n - 1):
            for j in range(i + 1, n):
                if s[i] == s[j]:
                    ans += 1
                else:
                    break
        print(ans)
     
     
    def SortString(text):
        return "".join(sorted(list(text)))
     
     
    if __name__ == '__main__':
        main()
Problem p03000 (python)

Fixed submission:
def bound(n, x, l):
    coordinate = 0
    for i in range(n):
        coordinate += l[i]
        if x < coordinate:
            return i
        else:
            continue
    return n


n, x = map(int, input().split())
l = list(map(int, input().split()))
countbound = bound(n, x, l)
print(countbound+1)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = list(map(int, input().split()))
countBound = 0
coordinate = 0
# print(l)

while countBound <= n + 1:
    coordinate += l[countBound]
    countBound += 1
    if coordinate > x:
        break
    else:
        continue

print(countBound)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = list(map(int, input().split()))
countBound = 0
coordinate = 0
# print(l)

while countBound <= n + 1:
    coordinate += l[countBound]
    countBound += 1
    if coordinate > x:
        break
    else:
        continue

print(countBound)
Problem p03001 (python)

Fixed submission:
w, h, x, y = map(int, input().split())
print((w * h) / 2, 1 if [x * 2, y * 2] == [w, h] else 0)

Buggy submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())
print((x * y) / 2, 1 if [x, y]=[w / 2, h / 2] else 0)
Problem p03086 (python)

Fixed submission:
import re;print(max(map(len,re.split("[^ACGT]+",input()))))

Buggy submission (verdict: Runtime Error):
import re;print(len(max(re.findall(r"[ACGT]+",input()),key=len)))
Problem p03238 (python)

Fixed submission:
print("Hello World"if input()=="1"else int(input())+int(input()))

Buggy submission (verdict: Runtime Error):
print("Hello World"if input()=="1"else int(input())+int(input())
Problem p03260 (python)

Fixed submission:
print("YNeos"[eval(input().replace(" ","*"))%2==0::2])

Buggy submission (verdict: Runtime Error):
print("YNeos"[eval(input().replace(" ","*")%2==0)::2])
Problem p03282 (python)

Fixed submission:
def main():
  s=input()
  k=int(input())
  for i in s[:k]:
    if i!="1":
      print(i)
      return
  print("1")
main()

Buggy submission (verdict: Runtime Error):
s=input();k=int(input());print(1 if s[0:k]=="1"*k else s.replace("1","")[0])

Buggy submission (verdict: Runtime Error):
s=input();k=int(input());print(1 if s[0:k]=="1"*k else input().replace("1","")[0])

Buggy submission (verdict: Runtime Error):
print(input().replace("1","")[0])

Buggy submission (verdict: Runtime Error):
print(s=input().replace("1","")[0])
Problem p03292 (python)

Fixed submission:
a=sorted(list(map(int,input().split())))
print(a[-1]-a[0])

Buggy submission (verdict: Runtime Error):
a-sorted(list(map(int,input().split())))
print(a[-1]-a[0])
Problem p03311 (python)

Fixed submission:
n=int(input())
a=sorted([x-i for i,x in enumerate(list(map(int,input().split())))])
if n%2==1:
  print(sum([abs(x-a[n//2]) for x in a]))
else:
  print(min(sum([abs(x-a[n//2]) for x in a]),sum([abs(x-a[n//2+1]) for x in a])))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[x-i for i,x in enumerate(list(map(int,input().split())))]
if n%2==0:
  print(sum([abs(x-a[n//2]) for x in a]))
else:
  print(min(sum([abs(x-a[n//2]) for x in a]),sum([abs(x-a[n//2+1]) for x in a])))
Problem p03323 (python)

Fixed submission:
a,b=map(int,input().split());print("Y:a(y !"[a>8 or 8<b::2])

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split());print("Y:a(y !"[a>8or8<b::2])
Problem p03356 (python)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return r'\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
u=UnionFind(n)
ans=0
p=list(map(lambda x:int(x)-1,input().split()))
for i in range(m):
  a,b=map(lambda x:x-1,map(int,input().split()))
  u.union(a,b)
for i in range(n):
  if u.same(i,p[i]):
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return r'\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
u=UnionFind(n)
ans=0
p=list(map(lambda x:int(x-1),input().split()))
for i in range(m):
  a,b=map(lambda x:x-1,map(int,input().split()))
  u.union(a,b)
for i in range(n):
  if u.same(i,p[i]):
    ans+=1
print(ans)
Problem p03424 (python)

Fixed submission:
_=input();s=input().split();print("TFhoruere"["Y"in s::2])

Buggy submission (verdict: Runtime Error):
_=input();s=list(map(int, input().split()));print("TFhoruere"["Y"in s::2])
Problem p03469 (python)

Fixed submission:
print(input().replace("7/","8/"))

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
def main():
  n,h=map(int,input().split())
  a=[None]*n
  b=a[:]
  ans=0
  for i in range(n):
    a[i],b[i]=map(int,input().split())
  m=max(a)
  b=sorted(b,reverse=True)
  x=bisect_left(b,m)
  for i in b[:n]:
    h-=i
    ans+=1
    if h<=0:
      print(ans)
      return
  ans+=(h+m-1)//m
  print(ans)
main()
Problem p03575 (python)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return r'\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
a=[None]*m
b=a[:]
ans=0
for i in range(m):
  a[i],b[i]=map(lambda x:x-1,map(int,input().split()))
for i in range(m):
  u=UnionFind(n)
  for j in range(m):
    if j!=i:
      u.union(a[j],b[j])
  if u.size(0)!=n:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return r'\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
a=[None]*m
b=a[:]
ans=0
for i in range(m):
  a[i],b[i]=map(lambda x:x-1,map(int,input().split()))
for i in range(m):
  u=UnionFind(n)
  for j in range(i):
    if j!=i:
      u.union(a,b)
  if u.size(0)!=n:
    ans+=1
print(ans)
Problem p03624 (python)

Fixed submission:
from string import ascii_lowercase
s=set(input())
l=sorted([x for x in ascii_lowercase if not x in s])
if l:
  print(l[0])
else:
  print("None")

Buggy submission (verdict: Runtime Error):
from string import ascii_lowercase
s=set(input())
print(sorted([x for x in ascii_lowercase if not x in s])[0])
Problem p03680 (python)

Fixed submission:
import sys


def main():
    n = int(input())
    a = [0] * n
    for i in range(n):
        a[i] = int(sys.stdin.readline()) - 1
    sw = [False for _ in range(n)]
    nextsw = 0
    while True:
        if nextsw == 1:
            print(sw.count(True))
            return
        if sw[nextsw]:
            print(-1)
            return
        sw[nextsw] = True
        nextsw = a[nextsw]


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
  n = int(input())
  a =[]
  for n in range(n):
    a.append(int(input())-1)
  sw = [0]
  while True:
    nextsw = sw[-1]
    if nextsw = 1:
      print(len(sw))
      return
    if nextsw in sw:
      print(-1)
      return
    sw.append(nextsw)

main()
Problem p03719 (python)

Fixed submission:
a,b,c=map(int,input().split());print("NYoe s"[a<=c<=b::2])

Buggy submission (verdict: Runtime Error):
print("NYoe s"[eval(input().replace(" ","<=")::2)])
Problem p03729 (python)

Fixed submission:
a,b,c=input().split();print("YNEOS"[a[-1]!=b[0]or b[-1]!=c[0]::2])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int, input().split());print("YNeos"[a[-1]!=b[0]or b[-1]!=c[0]::2])
Problem p03837 (python)

Fixed submission:
def resolve():
    from scipy.sparse.csgraph import shortest_path
    import scipy
    import numpy as numpy
    n, m = map(int, input().split())
    row = [None] * m
    col = row[:]
    data = row[:]
    for i in range(m):
        row[i], col[i], data[i] = map(int, input().split())
        row[i] -= 1
        col[i] -= 1
    a = scipy.sparse.csr_matrix((data, (row, col)), shape=(n, n)).toarray()
    s, p = shortest_path(a, return_predecessors=True, directed=False)
    l = [[True] * n for _ in range(n)]
    for start in range(n - 1):
        for goal in range(start + 1, n):
            path = get_path(start, goal, p)
            for i in range(len(path) - 1):
                l[path[i]][path[i + 1]] = False
                l[path[i + 1]][path[i]] = False
    ans = 0
    for i, j in zip(row, col):
        if l[i][j]:
            ans += 1
    print(ans)


def get_path(start, goal, pred):
    return get_path_row(start, goal, pred[start])


def get_path_row(start, goal, pred_row):
    path = []
    i = goal
    while i != start and i >= 0:
        path.append(i)
        i = pred_row[i]
    if i < 0:
        return []
    path.append(i)
    return path[::-1]


resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    from scipy.sparse.csgraph import shortest_path
    import scipy
    import numpy as numpy
    n, m = map(int, input().split())
    row = [None] * m
    col = row[:]
    data = row[:]
    for i in range(m):
        row[i], col[i], data[i] = map(int, input().split())
        row[i] -= 1
        col[i] -= 1
    a = scipy.sparse.csr_matrix((data, (row, col)), shape=(n, n))
    s, p = shortest_path(a, return_predecessors=True, directed=False)
    l = [[True] * n for _ in range(n)]
    for start in range(n - 1):
        for goal in range(start + 1, n):
            path = get_path(start, goal, p)
            for i in range(len(path) - 1):
                l[path[i]][path[i + 1]] = False
                l[path[i + 1]][path[i]] = False
    ans = 0
    for i, j in zip(row, col):
        if l[i][j]:
            ans += 1
    print(ans)


def get_path(start, goal, pred):
    return get_path_row(start, goal, pred[start])


def get_path_row(start, goal, pred_row):
    path = []
    i = goal
    while i != start and i >= 0:
        path.append(i)
        i = pred_row[i]
    if i < 0:
        return []
    path.append(i)
    return path[::-1]


resolve()
Problem p03854 (python)

Fixed submission:
import re;print("YNEOS"[re.match(r"^(dream|dreamer|erase|eraser)+$",input())==None::2])

Buggy submission (verdict: Runtime Error):
def main():
  s=input()
  q=[0]
  m=len(s)
  l=["dream","dreamer","erase","eraser"]
  while q:
    i=q.pop()
    if i==n:
      print("YES")
      return
    for j in l:
      nj=len(j)
      if i+nj<=m and s[i:i+nj]==j:
        q.append(i+nj)
  print("NO")

main()

Buggy submission (verdict: Runtime Error):
def main():
  q=[input()]
  l=["dream","dreamer","erase","eraser"]
  while q:
    s=q.pop()
    if s="":
      print("YES")
      return
    for i in l:
      n=len(i)
      if s[:n]==i:
        q.append(s[n:])
  print("NO")

main()
Problem p04032 (python)

Fixed submission:
def main():
    s = str(input())
    sLen = len(s)
    for i in range(sLen - 2):
        if s[i] == s[i + 1]:
            print(i + 1, i + 2)
            return
        elif s[i] == s[i + 2]:
            print(i + 1, i + 3)
            return
    if s[sLen - 2] == s[sLen - 1]:
        print(sLen - 1, sLen)
        return

    print("-1 -1")


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = str(input())
    sLen = len(s)
    for i in range(sLen - 2):
        if s[i] == s[i + 1]:
            print(i + 1, i + 2)
            return
        elif s[i] == s[i + 2]:
            print(i + 1, i + 3)
            return
    if s[sLen - 2] == s[sLen - 1]:
        print(slen - 1, sLen)
        return

    print("-1 -1")


if __name__ == "__main__":
    main()
Problem p02646 (python)

Fixed submission:
#2問目
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
idouA = 0
idouB = 0
kankaku = 0

#逃げる方が大きかったら確実に捕まえられない
if W >= V:
    print("NO")
else:
    idouA = V * T
    idouB = W * T
    if A < B:
        if A < 0 and B < 0:
            kankaku = abs(A) - abs(B)
        elif A >= 0 and B >= 0:
            kankaku = abs(B) - abs(A)
        elif A <= 0 and B >= 0:
            kankaku = B - A
    elif B < A:
        if A < 0 and B < 0:
            kankaku = abs(B) - abs(A)
        elif A >= 0 and B >= 0:
            kankaku = abs(A) - abs(B)
        elif A >= 0 and B <= 0:
            kankaku = A - B
            
    if(idouB + kankaku <= idouA):
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
#2問目
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
idouA = 0
idouB = 0

#逃げる方が大きかったら確実に捕まえられない
if W >= V:
    print("NO")
else:
    idouA = V * T
    idouB = W * T
    if A < B:
        if A < 0 and B < 0:
            kankaku = abs(A) - abs(B)
        elif A > 0 and B > 0:
            kankaku = abs(B) - abs(A)
    elif B < A:
        if A < 0 and B < 0:
            kankaku = abs(B) - abs(A)
        elif A > 0 and B > 0:
            kankaku = abs(A) - abs(B)
            
    if(idouB + kankaku <= idouA):
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
#2問目
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
idouA = 0
idouB = 0

#逃げる方が大きかったら確実に捕まえられない
if W >= V:
    print("NO")
else:
    idouA = V * T
    idouB = W * T
    if A < B:
        if A < 0 and B < 0:
            kankaku = abs(A) - abs(B)
        elif A > 0 and B > 0:
            kankaku = abs(B) - abs(A)
    elif B < A:
         if A < 0 and B < 0:
            kankaku = abs(B) - abs(A)
        elif A > 0 and B > 0:
            kankaku = abs(A) - abs(B)
            
    if(idouB + kankaku <= idouA):
        print("YES")
    else:
        print("NO")
Problem p02660 (python)

Fixed submission:
#4問目
N = int(input())

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

def has_duplicates2(seq):
    seen = []
    unique_list = [x for x in seq if x not in seen and not seen.append(x)]
    return len(seq) != len(unique_list)

fact = prime_factorize(N)
# print(fact)
result  =  0

if has_duplicates2(fact):
    #重複した数字のリスト
    chofuku = [x for x in set(fact) if fact.count(x) > 1]
    for i in chofuku:
        flag = True
        n = 1
        Count = fact.count(i) + 1
        while flag:
            if(1/2 * n * (n - 1) < Count <= 1/2 * n * (n + 1)):
                result += n-1
                flag = False
            else:
                n += 1
    
    #重複していない数の個数
    NOTchofuku = len((list(set(fact)))) - len(chofuku)
    print(result + NOTchofuku)
else:
    print(len(fact))

Buggy submission (verdict: Runtime Error):
#4問目
N = int(input())

# 使った数字を入れておくやつ
save = []

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

def has_duplicates2(seq):
    seen = []
    unique_list = [x for x in seq if x not in seen and not seen.append(x)]
    return len(seq) != len(unique_list)

fact = prime_factorize(N)
# print(fact)
result  =  0
if has_duplicates2(fact):
    #重複した数字のリスト
    chofuku = [x for x in set(fact) if fact.count(x) > 1]
#     print(chofuku)
    for i in chofuku:
        Count = fact.count(i)
#         print(Count)
        if(Count == 3):
            result += 2
        else:
            result += math.floor(Count / 2)
#         print(result)
    #重複していない数の個数
    NOTchofuku = len((list(set(fact)))) - len(chofuku)
    print(result + NOTchofuku)
else:
    print(len(fact))