Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

# coding: utf-8
# Your code here!
import numpy as np
import random

N, M, Q = map(int, input().rstrip().split(' '))

count = np.zeros((N+1, N+1)).astype(int)
memo = np.zeros((N+1, N+1)).astype(int)

for _ in range(M):
    p, q = map(int, input().rstrip().split(' '))
    count[p, q] += 1

for i in range(1,N+1):
    for j in range(1,N+1):
        memo[i][j] = count[i][j] + memo[i-1][j-1] + (memo[i-1][j] - memo[i-1][j-1]) + (memo[i][j-1] - memo[i-1][j-1])

for i in range(Q):
    p, q = map(int, input().rstrip().split(' '))
    print(memo[q][q] - memo[p-1][q] - memo[q][p-1] + memo[p-1][p-1])
    


### FIXED CODE ###

# coding: utf-8
# Your code here!

N, M, Q = map(int, input().rstrip().split(' '))

count = [[0] * (N + 1) for _ in range(N+1)]
memo = [[0] * (N + 1) for _ in range(N+1)]

for _ in range(M):
    p, q = map(int, input().rstrip().split(' '))
    count[p][q] += 1

for i in range(1,N+1):
    for j in range(1,N+1):
        memo[i][j] = count[i][j] + memo[i-1][j] + memo[i][j-1] - memo[i-1][j-1]

for i in range(Q):
    p, q = map(int, input().rstrip().split(' '))
    print(memo[q][q] - memo[p-1][q] - memo[q][p-1] + memo[p-1][p-1])
### BUGGY CODE ###

n,k,q=(int(x) for x in input().split())
a=[]
for i in range(q):
    a.append(int(input()))
p=[0]*n
for i in range(k):
    for j in range(n):
        p[j]+=1
for i in range(n):
    for j in range(q):
        p[i]-=1
        if a[j]-1 == i:
            p[i]+=1


for i in range(n):
    if p[i]>0:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

n,k,q=(int(x) for x in input().split())
a=[]
for i in range(q):
    a.append(int(input()))
p=[k-q]*n

for i in range(q):
    p[a[0]-1]+=1
    del a[0]

for i in range(n):
    if p[i]>0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

s=int(input())
k=[]
for i in range(s):
    j=input()
    if j in k:
        k.remove(j)
    else:
        k.append(j)
print(len(k))

### FIXED CODE ###

import collections
s=int(input())
k = [input() for i in range(s)]
c = collections.Counter(k)
z=c.values()
lst=[ e for e in z if e%2==1]
print(len(lst))
### BUGGY CODE ###

import sys

n = int(input())
aaa = list(map(int, sys.stdin))
MOD = 998244353

s = sum(aaa)
dp1 = [0] * (s + 1)
dp2 = [0] * (s + 1)
dp1[0] = 1
dp2[0] = 1
tmp_sum = 0
for a in aaa:
    for i in range(tmp_sum, -1, -1):
        dp1[i + a] += dp1[i]
        dp1[i] *= 2
        dp2[i + a] += dp2[i]
    for i in range(tmp_sum, -1, -1):
        dp1[i] %= MOD
        dp2[i] %= MOD
    tmp_sum += a

h = (s + 1) // 2
ans = (pow(3, n, MOD) - sum(dp1[h:]) * 3) % MOD
if s % 2 == 0:
    ans = (ans + dp2[h] * 3) % MOD
print(ans)


### FIXED CODE ###

import sys

n = int(input())
aaa = list(map(int, sys.stdin))
MOD = 998244353

s = sum(aaa)
dp1 = [0] * (s + 1)
dp2 = [0] * (s + 1)
dp1[0] = 1
dp2[0] = 1
tmp_sum = 0
for a in aaa:
    for i in range(tmp_sum, -1, -1):
        dp1[i + a] += dp1[i]
        dp1[i] *= 2
        dp2[i + a] += dp2[i]
    for i in range(tmp_sum, -1, -1):
        dp1[i] %= MOD
        dp2[i] %= MOD
    tmp_sum += a

h = (s + 1) // 2
ans = (pow(3, n, MOD) - sum(dp1[h:]) * 3) % MOD
if s % 2 == 0:
    ans = (ans + dp2[h] * 3) % MOD
print(ans)
### BUGGY CODE ###

import math
import copy

n=int(input())
a=list(map(int,input().split()))
a.sort()
ch5=0
for  M in a:
  if M==1:
    ch5+=1
    a.remove(M)
if ch5>0:
  a.append(1)
B=copy.deepcopy(a)


dp=[0 for _ in range(1000000+1)]

sosuu = [2]
A = 1000
for L in range(3, A, 2): # 2 以外の素数は奇数なので
    for L2 in sosuu:
        if L % L2 == 0:
            break # 素数でないことがわかったらそれ以上ループする必要はない
    else: # break で抜けることがなかったら L は素数（Python 特有の制御構文）
        sosuu.append(L)
        
L=len(a)

if len(a)>80000:
  g=a[0]
  for h in range(1,L):
    g=math.gcd(g,a[h])
    
  if g==1:
    print('setwise coprime')
    
  else:
    print('not coprime')
  
  

else:
  ch1=0
  ch3=0
  for w in sosuu:
    ch2=0
    for q in range(L):
      if B[q]%w==0:
        ch2+=1
        S=B[q]
        while S%w==0:
          S=S//w
        B[q]=S
    if ch2>1:
      ch3+=1
  d={}
  ch4=0
  for u in B:
      if u>1000:
        if u not in d:
          d[u]=0
        else:
          ch4+=1
  if ch3==0 and ch4==0:
    print('pairwise coprime')
    
      
  
  
    
  else:
    g=a[0]
    for h in range(1,L):
      g=math.gcd(g,a[h])
    
    if g==1:
      print('setwise coprime')
    
    else:
      print('not coprime')
      
     

### FIXED CODE ###

import math

n=int(input())
a=list(map(int,input().split()))

dp=[0 for _ in range(1000001)]

for d in a:
  dp[d]+=1
  
ch1=0
for i in  range(2,1000001):
  ch=0
  x=i
  while x<=1000000:
    ch+=dp[x]
    x+=i
  if ch>1:
    ch1+=1
    
if ch1==0:
  print('pairwise coprime')
  
else:
  g=a[0]
  for h in range(1,n):
    g=math.gcd(g,a[h])
    
  if g==1:
    print('setwise coprime')
    
  else:
    print('not coprime')
### BUGGY CODE ###

n,m = map(int,input().split())
visited = [-1 for _ in range(n+1)]
visited[1] = 0
will = []
root = [[] for _ in range(n+1)] 
for i in range(m):
    a,b = map(int,input().split())
    root[a].append(b)
    root[b].append(a)

will.append(1)

while will:
    visit = will.pop(0)
    for i in root[visit]:
        if visited[i] != -1:
            continue
        if i in will:
            continue
        will.append(i)
        visited[i] = visit

if visited[1:] == -1:
    print('No')
else:
    print('Yes')
    for i in range(2,len(visited)):
        print(visited[i])


### FIXED CODE ###

n,m = map(int,input().split())
visited = [-1 for _ in range(n+1)]
visited[1] = 0
will = []
root = [[] for _ in range(n+1)] 
for i in range(m):
    a,b = map(int,input().split())
    root[a].append(b)
    root[b].append(a)

will.append(1)

while will:
    visit = will.pop(0)
    for i in root[visit]:
        if visited[i] != -1:
            continue
        will.append(i)
        visited[i] = visit

if visited[1:] == -1:
    print('No')
else:
    print('Yes')
    for i in range(2,len(visited)):
        print(visited[i])
### BUGGY CODE ###

import sys
from io import StringIO
import unittest

def resolve():
    N, M, K = [int(x) for x in input().split()]
    global list, block, seen, osusume
    list = [[] for _ in range(N)]
    block = [[] for _ in range(N)]
    seen = [[False] * N for _ in range(N)]
    osusume = [[] for _ in range(N)]

    for _ in range(M):
        A, B = [int(x)-1 for x in input().split()]
        list[A].append(B)
        list[B].append(A)

    for _ in range(K):
        C, D = [int(x)-1 for x in input().split()]
        block[C].append(D)
        block[D].append(C)

    for i in range(N):
        dfs(i, i)
        print(len(osusume[i]), end=" ")

def dfs(v, origin):

    stacka = list[v]

    if(seen[origin][v] == True):
        return
    seen[origin][v] = True

    if not v in list[origin] and not v in block[origin] and v != origin:
        osusume[origin].append(v)

    for i in stacka:
        dfs(i, origin)
resolve()

### FIXED CODE ###

class UnionFind:
    def __init__(self, N, l):
        self.roots = list(range(N+1))
        self.counter = [1]*(N+1)
        for a, b in l:
            self.union(a, b)
 
    def get_root(self, n):
        if self.roots[n] != n:
            self.roots[n] = self.get_root(self.roots[n])
        return self.roots[n]
 
    def union(self, a, b):
        a, b = sorted([self.get_root(a), self.get_root(b)])
        if a != b:
            self.roots[b] = a
            self.counter[a] += self.counter[b]
            self.counter[b] = 0
 
    def find(self, a, b):
        return self.get_root(a) == self.get_root(b)
 
    def count(self, x):
        return(self.counter[self.get_root(x)])
 
 
N, M, K = [int(i) for i in input().split()]
ab = [[int(i) for i in input().split()] for _ in range(M)]
cd = [[int(i) for i in input().split()] for _ in range(K)]
friend = [[] for _ in range(N+1)]
uf = UnionFind(N, ab)
 
for a, b in ab:
    friend[a].append(b)
    friend[b].append(a)
 
ans = [uf.count(i)-1-len(friend[i]) for i in range(N+1)]
 
for c, d in cd:
    if uf.find(c, d):
        ans[c] -= 1
        ans[d] -= 1
 
print(*ans[1:])
### BUGGY CODE ###

n = int(input())
a = []
for i in range(n):
    temp = int(input())
    a.append(temp)
a.reverse()
b = [a[0]]
counter = 1
for i in range(1,n):
    temp = False
    for k in range(counter):
        if a[i] < b[k]:
            b[k] = a[i]
            temp = True
            break
    if temp == False:
        b.append(a[i])
        counter += 1
print(counter)

### FIXED CODE ###

import bisect
n = int(input())
a = []
for i in range(n):
    temp = int(input())
    a.append(temp)
a.reverse()
b = [a[0]]
counter = 1
for i in range(1,n):
    if a[i] >= b[-1]:
        counter += 1
        b.append(a[i])
    else:
        ind = bisect.bisect_right(b,a[i])
        b[ind] = a[i]
print(counter)
### BUGGY CODE ###

import re
N = int(input())
S = input()

pattern = re.compile(r"#.")

count = 0
while True:
    S, c = re.subn(pattern, "##", S)
    if c == 0:
        break
    count += c

print(count)


### FIXED CODE ###

N = int(input())
S = input()

white_count = S.count(".")
black_count = 0
ans = white_count
for s in S:
    if s == "#":
        black_count += 1
    else:
        white_count -= 1
    if ans > black_count + white_count:
        ans = black_count + white_count

print(ans)
### BUGGY CODE ###

from functools import reduce

mod = 998244353

def nCr(N,a):
    if a == 0:
        return 1
    num = reduce(lambda x,y:x * y % mod,range(N,N-a,-1))
    den = reduce(lambda x,y:x * y % mod,range(1,a+1))
    return num * pow(den,mod-2,mod)%mod

n,m,k = map(int,input().split())
ans = 0
for i in range(k+1):
    ans += (pow(m-1,n-1-i,mod)*nCr(n-1,i))% mod
    ans %= mod
print((m * ans)%mod)

### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 998244353
N,m,k = map(int,input().split())
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans = 0
for i in range(k+1):
    ans += (pow(m-1,N-1-i,mod)*cmb(N-1,i,mod))% mod
    ans %= mod
print((m * ans)%mod)
### BUGGY CODE ###

import math
from functools import reduce

def gcd(a,b,c):
    d = math.gcd(a,b)
    return math.gcd(d,c)
cnt =0
K = int(input())
for i in range(1,K+1):
    for m in range(1,K+1):
        for u in range(1,K+1):
            cnt+= gcd(i,m,u)
print(cnt)

### FIXED CODE ###

import math
K = int(input())

def gcd(a,b):
    return math.gcd(a,b)
cnt=0
for i in range(1,K+1):
    for m in range(1,K+1):
        d = math.gcd(i,m)
        for u in range(1,K+1):
            cnt+=math.gcd(d,u)
            
print(cnt)
### BUGGY CODE ###

k,s = map(int,input().split())
ans = 0

for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x + y + z == s:
        ans += 1
print(ans)

### FIXED CODE ###

k,s = map(int,input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    if 0 <= s - i - j <= k:
      ans += 1
      
print(ans)
### BUGGY CODE ###

L,R = map(int,input().split())

# Rが2019未満のとき
if R < 2019 :
    print((L * (L + 1)) % 2019)
# 範囲内に2019を含む時
elif L <= 2019 and R >= 2019 :
    print(0)
# LもRも2019より高い場合
else :
    R = min(R, L + 4038)
    ans = 2018
    for i in range(L,R + 1):
        for j in range(i + 1,R + 1):
            x = (i * j) % 2019
            ans = min(ans, x)
    print(ans)


### FIXED CODE ###

L,R = map(int,input().split())

# Rが2019未満のとき
if R < 2019 :
    print((L * (L + 1)) % 2019)
# 範囲内に2019を含む時
elif L <= 2019 and R >= 2019 :
    print(0)
# LもRも2019より高い場合
else :
    R = min(R, L + 2018)
    ans = 2018
    for i in range(L,R + 1):
        b = i + 1
        for j in range(b,R + 1):
            x = (i * j) % 2019
            ans = min(ans, x)
    print(ans)
### BUGGY CODE ###

N = int(input())
a = [int(x) for x in input().split()]

res = ""
for i in range(N):
    res += str(a.index(i+1)+1) + " "

print(res)


### FIXED CODE ###

N = int(input())
a = [int(x) for x in input().split()]

l = {}
for i in range(N):
    l[i] = a[i]

sorted_l = sorted(l.items(), key=lambda x: x[1])

res = ""
for key, value in sorted_l:
    res += str(key + 1) + " "


print(res)
### BUGGY CODE ###

def main():
    N = int(input())
    a = list(map(int, input().split()))
    m = 10 ** 9 + 7
    ans = 0

    for i in range(N - 1):
        for j in range(i + 1, N):
            tmp = a[i] ^ a[j]
            ans += tmp % m
            ans %= m

    print(ans)

if __name__ == '__main__':
    main()
    

### FIXED CODE ###

def main():
    N = int(input())
    l = list(map(int, input().split()))
    ans = 0
    m = 10**9 + 7
    
    for i in range(60):
        x = 0
        for j in l:
            x += 1 & j >> i
        
        tmp = x * (N - x) % m
        tmp *= 2 ** i % m
        ans += tmp
        ans %= m

    print(ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

m,n=map(int,input().split())
print(m**n%1000000007)

### FIXED CODE ###

m,n=map(int,input().split())
print(pow(m,n,1000000007))
### BUGGY CODE ###

N = int(input())
N_array = [x for x in range(1, N + 1, 1)]
N_array.pop(N - 1)
print(sum(N_array))

### FIXED CODE ###

N = int(input())
print(sum(range(1, N)))
### BUGGY CODE ###

from bisect import bisect_left
N, M=map(int, input().split())
A=list(map(int, input().split()))
lst=[list(map(int, input().split())) for _ in range(M)]
A.sort()
lst.sort(key=lambda x: (x[1], x[0]), reverse=True)
for i in range(M):
  index=bisect_left(A, lst[i][1])
  if index-1>=lst[i][0]:
    A[:index]=A[lst[i][0]:index]+[lst[i][1] for _ in range(lst[i][0])]
  else:
    A[:index]=[lst[i][1] for _ in range(index)]
    break
print(sum(A))

### FIXED CODE ###

from collections import defaultdict
N, M=map(int, input().split())
A=list(map(int, input().split()))
d=defaultdict(int)
for a in A:
  d[a]+=1
for i in range(M):
  B, C=map(int, input().split())
  d[C]+=B
index_list=sorted(d)
ans=0
ans_size=0
for i in range(len(index_list)-1, -1, -1):
  card=index_list[i]
  if d[card]+ans_size>=N:
    ans+=(N-ans_size)*card
    break
  else:
    ans+=d[card]*card
    ans_size+=d[card]
print(ans)
### BUGGY CODE ###

from collections import deque


h, w = map(int,input().split())
ch, cw = map(lambda x: int(x) - 1, input().split())
dh, dw = map(lambda x: int(x) - 1, input().split())

G = []
for i in range(h):
    G.append(list(input()))

queue = deque([(ch, cw)])
S = [[float("inf")]*w for _ in range(h)]
S[ch][cw] = 0

while queue:
    y, x = queue.popleft()
    dx_dy = ((1,0),(0,1),(-1,0),(0,-1))
    ans = S[y][x]

    if (y, x) == (dh, dw):
            S[y][x] = ans
            break

    for j, i in dx_dy:
        if 0 <= x+i < w and 0 <= y+j < h and S[y+j][x+i] > ans and G[y+j][x+i] == ".":
            queue.appendleft((y+j, x+i))
            S[y+j][x+i] = ans
            

    ans += 1
    for i in range(-2, 3):
        for j in range(-2, 3):
            if 0 <= x+i < w and 0 <= y+j < h and S[y+j][x+i] > ans and G[y+j][x+i] == ".":
                S[y+j][x+i] = ans
                queue.append((y+j, x+i))


if S[dh][dw] == float("inf"):
    print(-1)
else:
    print(S[dh][dw])


### FIXED CODE ###

from collections import deque


h, w = map(int,input().split())
ch, cw = map(lambda x: int(x) - 1, input().split())
dh, dw = map(lambda x: int(x) - 1, input().split())

G = []
for i in range(h):
    G.append(list(input()))

queue = deque([(ch, cw)])
S = [[float("inf")]*w for _ in range(h)]
S[ch][cw] = 0

while queue:
    y, x = queue.popleft()
    dx_dy = ((1,0),(0,1),(-1,0),(0,-1))
    ans = S[y][x]

    if (y, x) == (dh, dw):
            S[y][x] = ans
            break

    for j, i in dx_dy:
        if 0 <= x+i < w and 0 <= y+j < h and S[y+j][x+i] > ans and G[y+j][x+i] == ".":
            queue.appendleft((y+j, x+i))
            S[y+j][x+i] = ans
            

    ans += 1
    for i in range(-2, 3):
        for j in range(-2, 3):
            if 0 <= x+i < w and 0 <= y+j < h and S[y+j][x+i] > ans and G[y+j][x+i] == ".":
                S[y+j][x+i] = ans
                queue.append((y+j, x+i))


if S[dh][dw] == float("inf"):
    print(-1)
else:
    print(S[dh][dw])
### BUGGY CODE ###

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

maxi = 0
idx = 0
for i in range(M):
    maxi = max(A)
    idx = A.index(maxi)
    A[idx] = maxi//2
print(sum(A))

### FIXED CODE ###

import sys
import os
import math
import heapq

N, M = map(int,input().split())
A = list(map(int,input().split()))
#大きいものから取り出したいので-1倍してqueueに入れる

Q = []
for a in A:
    heapq.heappush(Q,-a)

for i in range(M):
    first = -heapq.heappop(Q)
    first = first//2
    heapq.heappush(Q,-first)

print(-sum(Q))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
from sys import stdin
from itertools import accumulate

s_in = lambda: stdin.readline()[:-1] # s = s_in()
d_in = lambda: int(stdin.readline()) # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split())) # List = ds_in()

MOD = 10**9 + 7

N = d_in()
A_list = ds_in()

def factorial(N):
    val = 1
    for i in range(1, N+1):
        val = (val * i) % MOD
    return val

def recursive_square(n, m, p):
    """ n**p (mod m) """
    if p == 0:
        return 1 % m
    if p % 2 == 0:
        root = recursive_square(n, m, p//2) % m 
        return (root ** 2) % m
    else:
        return ((n % m) * recursive_square(n, m, p-1)) % m


N_factorial = factorial(N)

Coefs = []
for i in range(1, N+1):
    Coefs.append((N_factorial * recursive_square(i, MOD, MOD-2)) % MOD)

Cum_Coefs = list(accumulate(Coefs))
Cum_Coefs = list(map(lambda x: x % MOD, Cum_Coefs))

if N == 1:
    print(A_list[0])
else: 
    ans = 0
    for i in range(N):
        ans = (ans + A_list[i] * (Cum_Coefs[i] + Cum_Coefs[N-i-1] - Cum_Coefs[0])) % MOD 
    print(ans)



### FIXED CODE ###

# -*- coding: utf-8 -*-
from sys import stdin
from itertools import accumulate

s_in = lambda: stdin.readline()[:-1] # s = s_in()
d_in = lambda: int(stdin.readline()) # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split())) # List = ds_in()

MOD = 10**9 + 7

N = d_in()
A_list = ds_in()

def factorial(N):
    val = 1
    for i in range(1, N+1):
        val = (val * i) % MOD
    return val

def recursive_square(n, m, p):
    """ n**p (mod m) """
    if p == 0:
        return 1 % m
    if p % 2 == 0:
        root = recursive_square(n, m, p//2) % m 
        return (root ** 2) % m
    else:
        return ((n % m) * recursive_square(n, m, p-1)) % m
        
def factorize(n):
    if n == 1:
        return [(1, 1)]
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

N_factorial = factorial(N)

Coefs = []
lastval = 0
Inv = dict()
for i in range(1, N+1):
    fac = factorize(i)
    temp = N_factorial
    for f in fac:
        if f[0] not in Inv.keys():
            Inv[f[0]] = recursive_square(f[0], MOD, MOD-2)
        for _ in range(f[1]):
            temp = (temp * Inv[f[0]]) % MOD
    lastval = (lastval + temp) % MOD
    Coefs.append(lastval)

if N == 1:
    print(A_list[0])
else: 
    ans = 0
    for i in range(N):
        ans = (ans + A_list[i] * (Coefs[i] + Coefs[N-i-1] - Coefs[0])) % MOD 
    print(ans)
### BUGGY CODE ###

n,m=[int(i) for i in input().split()]
a_list=[int(i) for i in input().split()]

b_list=[]
for i in range(m):
    b,c=map(int,input().split())
    b_list+=[c]*b
a_list+=b_list
a_list.sort(reverse=True)
print(sum(a_list[:n]))

### FIXED CODE ###

N,M = list(map(int,input().split()))
a_list = list(map(int,input().split()))
bc_list = []
for _ in range(M):
    b,c = list(map(int,input().split()))
    bc_list.append([b,c])

a_list = sorted(a_list)
bc_list = sorted(bc_list,key=lambda x: x[1],reverse=True)

tmp = 0
for i,a in enumerate(a_list):
    if tmp >= len(bc_list):
        break
    
    if a < bc_list[tmp][1]:
        bc_list[tmp][0] -= 1
        a_list[i] = bc_list[tmp][1]
    else:
        break

    if bc_list[tmp][0] == 0:
        tmp += 1
print(sum(a_list))
### BUGGY CODE ###

N = int(input())
S = list(input())

for i in range(N):
  ans = 0
  for j in range(N):
    f = {}
    b = {}
    for k in range(j):
      if S[k] in f.keys():
        f[S[k]] += 1
      else:
        f[S[k]] = 1
        
    for k in range(N-j):
      if S[N-k-1] in b.keys():
        b[S[N-k-1]] += 1
      else:
        b[S[N-k-1]] = 1

    for k in range(N):
      common = 0
      for l in f.keys():
        if l in b.keys():
          common += 1
     
      if common > ans:
        ans = common
        
print(ans)

### FIXED CODE ###

N = int(input())
S = list(input())

for i in range(N):
  ans = 0
  for j in range(N):
    f = {}
    b = {}
    for k in range(j):
      if S[k] in f.keys():
        f[S[k]] += 1
      else:
        f[S[k]] = 1
        
    for k in range(N-j):
      if S[N-k-1] in b.keys():
        b[S[N-k-1]] += 1
      else:
        b[S[N-k-1]] = 1

    for k in range(N):
      common = 0
      for l in f.keys():
        if l in b.keys():
          common += 1
     
      if common > ans:
        ans = common
        
print(ans)
### BUGGY CODE ###

s = input()
ans = 0
while True:
    if '01' in s: i = s.index('01')
    elif '10' in s: i = s.index('10')
    else: break
    s = s[:i] + s[i+2:]
    ans += 2
print(ans)

### FIXED CODE ###

from collections import deque
s = input()
ans = 0
d = deque(s[0])
for i in s[1:]:
    if len(d) != 0 and d[-1] != i:
        ans += 2
        d.pop()
    else:
        d.append(i)
print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(N)]
a.sort()
job = []
ans = 0
ind = 0
for i in range(1, M+1):
    if ind != N:
        while a[ind][0] <= i:
            job.append(a[ind][1])
            ind += 1
            if ind == N:
                break
    if job:
        job.sort()
        ans += job.pop(-1)
print(ans)

### FIXED CODE ###

import heapq as hq
import numpy as np

N, M = map(int, input().split())
job = [list(map(int, input().split())) for _ in range(N)]
ans = 0
job.sort()
job.append([np.inf, np.inf])
jobhq = []
index = 0
for day in range(1, M + 1):
    while day >= job[index][0]:
        hq.heappush(jobhq, - job[index][1])
        index += 1
    if jobhq:
        ans += - hq.heappop(jobhq)
print(ans)
### BUGGY CODE ###

import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B = sorted(A,reverse=True)
for a in A:
    C = copy.copy(B)
    C.remove(a)
    print(C[0])    

### FIXED CODE ###

import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B = sorted(A,reverse=True)
for a in A:
    if a < B[0]:
        print(B[0])    
    else:
        print(B[1])
### BUGGY CODE ###

import math
from functools import reduce

K = int(input())

def GCD(x):
    return reduce(math.gcd, x)

s = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for h in range(1,K + 1):
            s += GCD((i, j, h))

print(s)

### FIXED CODE ###

import math
from functools import reduce
from itertools import combinations_with_replacement

K = int(input())

def GCD(x):
    return reduce(math.gcd, x)

s = 0

for x in combinations_with_replacement(range(1, K + 1), 3):
    if x[0] == x[1] == x[2]:
        s += GCD(x)
    elif x[0] == x[1] or x[1] == x[2] or x[0] == x[2]:
        s += GCD(x) * 3
    else:
        s += GCD(x) * 6

print(s)
### BUGGY CODE ###

import sys
N=int(input())
ans=0
for i in range(2,int(N**(1/2))+1):
  if N%i==0:
    break
  if i==int(N**(1/2)):
    print(1)
    sys.exit()
i=1
k=1
while N % (2**i) == 0:
  ans+=1
  N=N//(2**i)
  i+=1
while N % 2 == 0:
  N=N//2
f=3
while f <= N:
  if N % (f**k) == 0:
    ans+=1
    N=N//(f**k)
    k+=1
  else:
    while N % f == 0:
      N=N//f
    f += 2
    k=1
print(ans)

### FIXED CODE ###

N=int(input())
ans=0
for i in range(2,10**6+1):
  anssub=0
  t=0
  while N%i==0:
    N=N//i
    anssub+=1
  while t*(t+1)//2<=anssub:
    t+=1  
  ans+=t-1
if N!=1:
  ans+=1
print(ans)