peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n = int(input())
c = 0
for i in range(2,10000000):
    
    if n % i == 0:
        
        n = n//i
        c+=1
        # print(i,n)

if c == 0 and n > 1:
    print(1)
else:
    print(c)
# Judge status: Accepted
from collections import defaultdict
import sys
s = input()
n = len(s)
dic = defaultdict(int)

for i in range(n):
    dic[s[i]] += 1
    if dic[s[i]]==2:
        print("no")
        sys.exit()

print('yes')
# Judge status: Wrong Answer
h = list(map(int, input().split()))
tmp = 0
if h[0] > h[2]:
    tmp = (24 - abs(h[0] - h[2])) * 60
else:
    tmp = (h[2] - h[0]) * 60

if h[1] > h[3]:
    tmp += (60 - abs(h[1] - h[3]) - 30)
else:
    tmp += h[3] - h[1]

ans = 0
while tmp > 0:
    tmp -= h[4]
    if tmp > 0:
        ans += h[4]

print(ans)
# Judge status: Accepted
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1:
    for i in range(1,len(s)):
        if s[i].islower() == True:
            continue
        else:
            if s[i] == 'C':
                continue
            else:
                print('WA')
                exit()
else:
    print('WA')
    exit()
print('AC')
# Judge status: Accepted
n,m,k = map(int, input().split())

# 行と列の組み合わせを全探索で試し、1回でも成立する場合は終了する
for i in range(n+1):
  for j in range(m+1):
    if i*(m-j) + j*(n-i) == k:
      print("Yes")
      exit()
print("No")
# Judge status: Wrong Answer
A, B = map(int, input().split())
for i in range(1, 10000):
  if int(0.08 * i) == A and int(0.01 * i) == B:
    print(i)
    quit()
print('-1')
# Judge status: Accepted
N = int(input())
print(int((N*(N-1))//2))
# Judge status: Accepted
value = int(input())

if value == 0:
    print("1")
else:
    print("0")
# Judge status: Accepted
(N, K) = [int(n) for n in input().split()]
A = [int(n) for n in input().split()]

L = 0
H = max(A)

def feasible(M): # M: maximum length    
    S = sum([(a - 1) // M for a in A])
    #print("S = {}, K = {}".format(S, K))
    return S <= K

# assert(not feasible(L))
assert(feasible(H))

while H - L > 1:
    #print(H, L)
    M = (H + L) // 2
    if feasible(M):
        H = M
    else:
        L = M

print(H)
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
x = list(map(int,input().split()))
a = sorted(x)
for j in x:
    if j <= a[n//2-1]: print(a[n//2])
    else: print(a[n//2-1])
# Judge status: Accepted
S = input()
N = len(S)
if S[:] == S[N-1::-1] and S[0:N//2] == S[N//2-1::-1] and S[(N+3)//2-1:] == S[N-1:(N+3)//2-2:-1]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, K = map(int, input().split())
P = [(int(i)+1)/2 for i in input().split()]

wa_temp = sum(P[0:K])
max_wa = wa_temp

for i in range(N-K):
    wa_temp = wa_temp - P[i] + P[i+K]
    if wa_temp > max_wa:
        max_wa = wa_temp
print(max_wa)
# Judge status: Accepted
L=lambda:list(map(int,input().split()))
n,k=L()
ab=sorted([L()for _ in range(n)])
for a,b in ab:
  k-=b
  if k<=0:
    print(a)
    exit()
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print('YNeos'[a+2*b<c::2])
# Judge status: Accepted
n=int(input())
w=list(map(int,input().split()))
ans=10000

for i in range(n):
  s1=0
  s2=0
  for j in range(i):
    s1=s1+w[j]
  for k in range(i, n):
    s2=s2+w[k]
  ans=min(ans, max(s1, s2)- min(s1, s2))
  
print(ans)
# Judge status: Accepted
n,*w=map(int,open(0).read().split())
s=10**9
sum_w=sum(w)
for i in range(1,n):
	s=min(s,abs(sum_w-2*sum(w[:i])))
print(s)
# Judge status: Accepted
L, R, d = map(int,input().split())
ans = 0
for i in range(L, R+1):
    if i % d  == 0:
        ans += 1
print(ans)
# Judge status: Accepted
A,B,C,K = map(int,input().split())

if K<=A:
  print(K)
elif K<=A+B:
  print(A)
elif K<=A+B+C:
  print(A-(K-B-A))
else:
  print(A-C)
# Judge status: Wrong Answer
n = int(input())
S = []
for i in range(n):
    S.append(input())
cnt_ac = 0
cnt_tle = 0
cnt_wa = 0
cnt_re = 0


for i in range(n):
    if S[i] == "AC":
        cnt_ac += 1
    elif S[i] == "TLE":
        cnt_tle += 1
    elif S[i] == "WA":
        cnt_wa += 1
    elif S[i] == "RE":
        cnt_re += 1

print("AC x　" + str(cnt_ac))
print("WA x　" + str(cnt_wa))
print("TLE x　" + str(cnt_tle))
print("RE x　" + str(cnt_re))
# Judge status: Wrong Answer
a = input()
a=a.replace("0B","")
a=a.replace("1B","")
if  a.find("B"):
    a=a.replace("0B","")
    a=a.replace("1B","")
    if a.find("B"):
        a=a.replace("B","")
        print(a)
else:
    print(a)
# Judge status: Accepted
s = input()
a = int(s[:2])
b = int(s[2:])

if 0<a<13:
    if 0<b<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0<b<13:
        print("YYMM")
    else:
        print("NA")
# Judge status: Wrong Answer
import random

S = input()
for i in range(100):
  x = random.randrange(len(S)-2)
  print(S[x] + S[x + 1] + S[x + 2])
# Judge status: Accepted

N = int(input())
AB = [list(map(int,input().split())) for _ in [0]*N]

c = [0]*N
d = [0]*N
for i,ab in enumerate(AB):
    a,b = ab
    c[i] = a
    d[i] = b
c.sort()
d.sort(reverse=True)

if N%2:
    L = c[N//2]
    R = d[N//2]
    print(R-L+1)
else:
    L1 = c[N//2-1]
    R1 = d[N//2]
    L2 = c[N//2]
    R2 = d[N//2-1]
    print((R1+R2)-(L1+L2)+1)
# Judge status: Accepted
a,b = map(int,input().split())
if a>12:
    print(b)
elif a>5:
    print(b//2)
else:
    print(0)
# Judge status: Accepted
S = list(input())
a = 0
SS = S[::-1]
for i in range(len(S)):
    if S[i] != SS[i]:
        a = a+1
print(a // 2)
# Judge status: Accepted
x = int(input())

if x >= 400 and x <= 599:
    print(8)
elif x >= 600 and x <= 799:
    print(7)
elif x >= 800 and x <= 999:
    print(6)
elif x >= 1000 and x <= 1199:
    print(5)
elif x >= 1200 and x <= 1399:
    print(4)
elif x >= 1400 and x <= 1599:
    print(3)
elif x >= 1600 and x <= 1799:
    print(2)
elif x >= 1800 and x <= 1999:
    print(1)
# Judge status: Wrong Answer
s=input()
l=len(s)
a=float('inf')
for i in range(l-2):
  x=int(s[i:i+3])
  if abs(x-753)<a:
    ans=x
    a=abs(x-753)
print(ans)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    N = int(input())

    ans = "No"
    while N >= 0:
        if N % 4 == 0:
            ans = "Yes"
            break
        N -= 7

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
def main():
    N, M = map(int, input().split(" "))
    if N == M:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
# -*- coding: utf-8 -*-
n = int(input())
print((1000-n%1000)%1000)
# Judge status: Accepted
x = int(input())
for i in range(1,361):
    if (x * i) % 360 == 0:
        k = i
        break
print(k)
# Judge status: Accepted
A,B,X = map(int,input().split(" "))
if A+B<X:
    print("NO")
else:
    if A>X:
        print("NO")
    else:
        if (X-A)>B:
            print("NO")
        else:
            print("YES")
# Judge status: Wrong Answer
n,q = map(int,input().split())
s = input()
t = [0]*(n+1)
for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2]=="AC" else 0)
print(t)
for i in range(q):
    l,r = map(int,input().split())
    print(t[r-1]-t[l-1])
# Judge status: Accepted
n = int(input())
a = int(n**(1/2))
ans = 0
for i in reversed(range(a + 1)):
    if n%i == 0:
        ans = i
        break
    else:
        pass
ans2 = int(n/ans)
print(ans + ans2 - 2)
# Judge status: Accepted
K,N=map(int,input().split())
A=list(map(int,input().split()))
A.append(K+A[0])
d=0
for i in range(N):
    d=max(d,A[i+1]-A[i])
print(K-d)
# Judge status: Wrong Answer
s = sorted(list(input()))

for i in range(97, 97 + 26):
  print(s.count(chr(i)))
  if s.count(chr(i)) %2 != 0:
    print('NO')
    exit()

print('YES')
# Judge status: Accepted
x, y, z = list(map(int, input().split()))
if(x<=y*z):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x, y = map(int, input().split())

cand = [(-x, y, 1), (x, y, 0), (-x, -y, 2), (x, -y, 1)] 

ans = 10e9
for a, b, c in cand:
    if a <= b:
        if ans > b - a + c:
            ans = b - a + c

print(ans)
# Judge status: Accepted
N, K = map(int,input().split())
S = input()
print(S[:K-1]+S[K-1:K].lower()+S[K:])
# Judge status: Wrong Answer
A,B=map(int,input().split())
if (A+B)%2==0:
  print((A+B)/2)
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
a, b, c = sorted(list(map(int, input().split())))
k = int(input())
print(a+b+c*(2**k))
# Judge status: Accepted
s, w = map(int, input().split())
print("unsafe" if w >= s else "safe")
# Judge status: Accepted
n = int(input())
v = list(map(int,input().split()))

v.sort()
ans = v[0]
for i in v:
   ans = (ans + i)/2
print(ans)
# Judge status: Accepted
X, Y = map(int, input().split())
n = 0
A = X
while A <= Y:
    n += 1
    A *= 2
print(n)
# Judge status: Accepted
n,m=map(int,input().split())
a=list(map(int,input().split()))

import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
x=1
for i in range(n):
  x=lcm(x,a[i]//2)

power=[0]*n
for i in range(n):
  while a[i]%2==0:
    a[i]//=2
    power[i]+=1
    
if power.count(power[0])==n:  
  print((m+x)//(2*x))
else:
  print(0)
# Judge status: Accepted
w,h,n = map(int,input().split())
xs = 0
ys = 0
xe = w
ye = h
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 2:
        xe = min(xe,x)
    elif a == 1:
        xs = max(xs,x)
    elif a == 4:
        ye = min(ye,y)
    else:
        ys = max(ys,y)
if xs < xe and ys < ye:
    print(abs(xs-xe)*abs(ys-ye))
else:
    print(0)
# Judge status: Accepted
S = list(input())
N = len(S)
ans = "Yes"

for i in range((N-1)//2):
    if ans == "Yes":
        if S[i] != S[N -1 - i]:
            ans = "No"

for i in range((N-1)//2 -1):
    if ans == "Yes":
        if S[i] != S[(N - 1)//2 -1 - i]:
            ans = "No"

for i in range((N-1)//2 - 1):
    if ans == "Yes":
        if S[(N + 3)//2 -1 + i ] != S[N - 1 - i]:
            ans = "No"

print(ans)
# Judge status: Wrong Answer
n = int(input())
rc = [list(map(str,input().split())) for i in range(n)]

rc = (list(enumerate(rc)))

rc.sort(key=lambda x:x[1][0], reverse=False)
rc.sort(key=lambda x:x[1][1], reverse=True)

for i in rc:
    print(i[0]+1)
# Judge status: Accepted
def keisan(x):
  ret_val=0
  for i in range(1,x):
    ret_val+=i
  return ret_val

N,M=map(int,input().split())
print(keisan(N)+keisan(M))
# Judge status: Wrong Answer
# ABC-137-D
import heapq
N, M = map(int, input().split())
BA = []
for _ in range(N):
    A, B = map(int, input().split())
    BA.append((-1*B, A))
heapq.heapify(BA)

ans = 0
check_M = 1
while check_M <= M:
    try:
        max_B = heapq.heappop(BA)
    except:
        break
    if max_B[1] <= check_M:
        ans += (-1) * max_B[0]
        check_M += 1

print(ans)
# Judge status: Accepted
N, M = map(int, input().split())

x = [[] for _ in range(N)]
a = [None] * M
for i in range(M):
    P, Y = map(int, input().split())
    x[P-1].append(Y)
    a[i] = (P, Y)

y = {}
for i in range(N):
    x[i].sort()
    for j, Y in enumerate(x[i]):
        y[(i+1, Y)] = j + 1
for i in range(M):
    print('{}{}'.format(str(a[i][0]).zfill(6), str(y[a[i]]).zfill(6)))
# Judge status: Accepted
n, k = map(int, input().split())
P = list(map(int, input().split()))
ans = 0
E = []

for p in P:
    E.append(p*(p+1)/(2*p))

cumsumE = [0]
for e in E:
    cumsumE.append(cumsumE[-1] + e)

for i in range(0, n+1-k):
    ans = max(ans, cumsumE[i+k]-cumsumE[i])
print(ans)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    X, Y = [int(x) for x in input().split()]
    ans = 0
    x = X
    while x <= Y:
        x = x * 2
        ans += 1
    print(ans)





if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
x = input()
# x = x.replace(1,14)
# replaceは，文字列しか使えない．
ls_x = x.split()

# xに入力した文字列たちを整数化

for i in range(len(ls_x)):
    ls_x[i] = int(ls_x[i])

if ls_x[0] == ls_x[1]:
    print("Draw")

if ls_x[0] == 1:
    print("Alice")

elif ls_x[1] == 1:
    print("Bob")

elif ls_x[0] > ls_x[1]:
    print("Alice")

elif ls_x[0] < ls_x[1]:
    print("Bob")
# Judge status: Accepted
from collections import deque
N = int(input())
A = deque()
for _ in range(N):
    a,b = list(map(int,input().split()))
    A.append([b,a])
A = list(A)
A.sort()
time = 0
for i in A:
    time += i[1]
    if time > i[0]:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

asum=sum(a) #当初の数列Aの要素の和
d={}

for i in a:
  if i in d:
    d[i]+=1
  else:
    d[i]=1

for b,c in bc:
  print(b)
  print(c)
  if b in d:
    asum+=d[b]*(c-b)
    if c in d:
      d[c]+=d[b]
    else:
      d[c]=d[b]
    d[b]=0
  print(asum)
# Judge status: Wrong Answer
X = int(input())
m = 100
a = 0

while m<X:
  m = int(1.01*m)
  a+=1

print(a)
# Judge status: Accepted
import sys
n,a,b = map(int,input().split())

if a > b:
  print(0)
  sys.exit()
  
if n == 1:
  if a == b:
    print(1)
    sys.exit()
  else:
    print(0)
    sys.exit()

print((b-a)*(n-2)+1)
# Judge status: Wrong Answer
n,m = map(int,input().split())
h = list(map(int,input().split()))

dic = {}
for i in range(1,n+1):
    dic[i] = 1
for j in range(1,m+1):
    h_1,h_2 = map(int,input().split())
    if h[h_1-1] < h[h_2-1]:
        dic[h_1] = 0
    else:
        dic[h_2] = 0
lis = list(dic.values())

print(lis.count(1))
# Judge status: Accepted
n = int(input())
a = [int(x) for x in input().split()]

count = 0
while(1):
   check = [x % 2 for x in a]
   if (sum(check) == 0):
      count += 1
      a = [x/2 for x in a]
   else:
      break

print(count)
# Judge status: Wrong Answer
A,B, C,K = input().split()
a = int(A)
b= int(B)
c =int(C)
k=int(K)
if k-a-b-c==0:
    print(a-c)
elif k-a-b>0 and k-a-c-b<0:
    print(2*a-k+b)
else:
    print(a)
# Judge status: Accepted
a = input()
b = input()
c = input()
turn = "a"
d = {"a":a,"b":b,"c":c}

while True:
    d[turn], turn = d[turn][1:], d[turn][0]
    if len(d[turn]) == 0:
        ans = turn.upper()
        break

print(ans)
# Judge status: Wrong Answer
import math


def median(array):
    if N % 2:
        return array[N // 2]
    else:
        return sum(array[N // 2 - 1: N // 2 + 1]) / 2


N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
x = median(A)
y = median(B)
if N % 2:
    print(y - x + 1)
else:
    temp = y - x + 1
    print(int(y - x) + int(y - x + 1))
# Judge status: Wrong Answer
N, R = map(int, input().split())

print(R - 100 * max(0, 10-N))
# Judge status: Accepted
MOD = 10**9+7

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    X, Y = list(mi())
    if 4*X-Y >= 0 and (4*X-Y)%2 == 0 and (4*X-Y)//2<= X:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
k, x = map(int, input().split())
l = max(-1000000, x - k + 1)
r = min(1000000, x + k - 1)
list = []
for i in range(l, r + 1):
    list.append(i)
    
print(list)
# Judge status: Wrong Answer
L=int(input())
ans=[]
for i in range(1,1000):
    for j in range(1,1000):
        k=L-(i+j)
        ans.append(i*j*k)
Y=max(ans)
print(f"{Y:.6f}")
# Judge status: Wrong Answer
S = input(str("Input text: "))
if 3 <= len(S) <= 20:
    print(S[:3].lower())
# Judge status: Accepted

n, x, y = map(int, input().split())

d = [0]*(n-1)
for i in range(1, n+1):
    for j in range(i+1,n+1):
        c = min(j-i, abs(i-x)+1+abs(j-y))
        d[c-1] = d[c-1] + 1

for i in d:
    print(i)
# Judge status: Accepted
x = int(input())
t = 1
while 2*x > t**2 + t:
    t += 1
print(t)
# Judge status: Accepted
n, m = list(map(int, input().split()))
if n <= 9 and m <= 9:
    print(n*m)
else:
    print(-1)
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

n,m = iim()

if n == 1 and m == 1:
    print(1)
elif n == 1:
    print(m-2)
elif m == 1:
    print(n-2)
else:
    print((n-2)*(m-2))
# Judge status: Accepted
a,b,k=map(int,input().split())

if a>=0 and b>=0:
    leftover = a - k
    if(leftover>=0):
        print(leftover, b)
    elif(b+leftover >= 0):
        print(0, b+leftover)
    else:
        print(0, 0)
# Judge status: Accepted
_, *a = map(int, open(0).read().split())
n = max(a)
print(n, min((abs(n/2 - i), i) for i in a)[1])
# Judge status: Accepted
r=int(input())
print(pow(r,2))
# Judge status: Accepted
a,b = map(int, input().split())

lista = [1,3,5,7,8,10,12]
listb = [4,6,9,11]

tmp = a in listb

# print(tmp)

if (a == 2 and b ==2):
    print("Yes")
elif (a in listb and b in listb):
    print("Yes")
elif (a in lista and b in lista):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from bisect import bisect_right
n=int(input())
A=[int(input()) for _ in range(n)][::-1]

DP=[A[0]]
for i in range(1,n):
    num=A[i]
    if num>=DP[-1]:
        DP.append(num)
    else:
        index=bisect_right(DP,num)
        DP[index]=num
print(len(DP))
# Judge status: Wrong Answer
x = int(input())

bu = [False]*2*10**5
bu[2] = True
cur = 2

while 1:
    if not bu[cur]:
        bu[::cur] = [True] * len(bu[::cur])
    cur += 1
    if cur>=x and not bu[cur]:
        print(cur)
        break
# Judge status: Wrong Answer
X, Y, Z = list(map(int, input().split()))
print(Z, Y, X)
# Judge status: Accepted
import numpy as np
N = int(input())
A = list(map(int, input().split()))
a = []
ans = 0

for i in range(N):
    a.append(A[i]-i-1)

# 平均値ではなく、中央値を使う
b = int(np.median(a))

for i in range(N):
    ans += abs(b-a[i])

print(ans)
# Judge status: Accepted
N = int(input())
v = sorted(list(map(int, input().split())))
ans = (v[0] + v[1]) / 2
for i in range(2, N):
  ans = (ans + v[i]) / 2
  
print(ans)
# Judge status: Wrong Answer
n = int(input())
mod = 10 ** 9 + 7
print(pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod))
# Judge status: Wrong Answer
l=[x for x in input()];print(max(l)*len(l))
# Judge status: Accepted
n, a, b = map(int, input().split())

print((n // (a + b)) * a + min(n%(a+b), a))
# Judge status: Accepted
a,b,c = input().split()

list = [a,b,c]

num = len(set(list))

print(num)
# Judge status: Accepted
s = input()
sum = 0
max = 0
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        sum += 1
    else: sum = 0
    if sum >= max: max = sum
print(max)
# Judge status: Accepted
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    s=str(i)
    if s == s[::-1]:
        ans+=1
print(ans)
# Judge status: Accepted
n = int(input())
#a,b = map(int,input().split())
a_L = list(map(int,input().split()))
#print(a_L)
if len(a_L) == len(set(a_L)):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import sys

input = sys.stdin.readline
import fractions


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    MOD = 10 ** 9 + 7

    x = 1
    for a in A:
        x = (a * x) // fractions.gcd(a, x)

    ans = 0
    for a in A:
        ans += x // a

    print(ans % MOD)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b, c = list(map(int, input().split()))
if a % 2 == 1 and b % 2 == 1 and c % 2 == 1:
    print(b * c)
else:
    print(0)
# Judge status: Wrong Answer
n,m=map(int,input().split())
if n==1:
    print(m)
    exit()
for i in range(int(m**0.5),0,-1):
    if m%i==0 and m//i>=n:
        print(i)
        break
# Judge status: Accepted
S=list(input())
K=int(input())
N=len(S)
for i in range(N):
  k=(ord('z')-ord(S[i])+1)%26
  if K>=k:
    S[i]='a'
    K-=k
S[-1]=chr(ord(S[-1])+K%26)
print(''.join(S))
# Judge status: Accepted
N,M = map(int,input().split())
A = set(list(map(int,input().split()))[1:])
for i in range(N-1):
    B = set(list(map(int,input().split()))[1:])
    A = A&B
print(len(A))
# Judge status: Accepted
import collections

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
 
N = int(input())

l = collections.Counter(prime_decomposition(N))

ans = 0
for p,c in l.items():
    i = 1
    while c >= i :
        c -=i
        i += 1
        ans +=1

print(ans)
# Judge status: Accepted
input_values = list(map(int, input().split()))
if input_values[0] == input_values[1]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
C = input()

# 数値(1〜26)→アルファベット(A〜Z)
num2alpha = lambda c: chr(c+64)

# アルファベット(A〜Z)→数値(1〜26)
alpha2num = lambda c: ord(c) -ord('A') + 1

i = alpha2num(C.upper()) + 1
ans = num2alpha(i)
print(ans.lower())
# Judge status: Accepted
a, b, c, x, y, = map(int, input().split())
price = 10 ** 16
for i in range(10 ** 7):
    price = min(price, i * 2 * c + max(0, x - i) * a + max(0, y - i) * b)
print(price)
# Judge status: Wrong Answer
N = int(input())
i = 1
total = 0
while i < N:
    if i % 3 != 0 and i % 5 != 0:
        total += i
    i += 1
print(total)
# Judge status: Wrong Answer
ip = int(input())

ans = 7

for i in range(1,8):
    if int(ans) % ip == 0:
        print(i)
        break
    else:
        ans = int(ans) * 10 + 7
        i += 1
# Judge status: Accepted
import math

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

print(math.ceil((a + b) / 2))
# Judge status: Accepted
a,b = map(int, input().split())
ans = a * b
print(ans)
# Judge status: Accepted
import math
n = int(input())
ans = [0] * (n + 1)
for x in range(1, int(math.sqrt(n))):
    for y in range(1, int(math.sqrt(n))):
        for z in range(1, int(math.sqrt(n))):
            a = x * x + y * y + z * z + x * y + y * z + z * x
            if n >= a >= 1:
                ans[a] += 1
print(*ans[1:],sep="\n")
# Judge status: Accepted
from collections import Counter
N = int(input())
S = input()
MOD = 10**9 + 7

A = [0]*26
for e in S:
    A[ord(e)-97] += 1

ans = 1
for e in A:
    ans *= e+1
    ans %= MOD
print((ans-1)%MOD)
# Judge status: Accepted
from math import *
N,X=map(int,input().split())
x=sorted([X]+list(map(int,input().split())))
d=[abs(x[i+1]-x[i]) for i in range(N)]
ans=0
for i in range(N):
    ans=gcd(ans,d[i])
print(ans)
# Judge status: Accepted
s  = input().split()
s.sort()
if s[0] == '5' and s[1] == '5' and s[2] == '7':
    print('YES')
else:
    print('NO')
# Judge status: Accepted
import bisect
def resolve():
    n = int(input())
    l = sorted(list(map(int,input().split())))
    ans = 0
    for a in range(n):
        for b in range(a+1,n):
            c = bisect.bisect_left(l,l[a]+l[b])
            if c > b:
                ans += c-b-1
            else:
                pass
    print(ans)
resolve()
# Judge status: Accepted
#113_A
X,Y=map(int,input().split())
print(X+Y//2)
# Judge status: Accepted
n = int(input())

if n < 1000:
    print("ABC")
else:
    print("ABD")
# Judge status: Accepted
# coding: utf-8

s = input().rstrip()

stk = []

for i in s:
    if i == "B":
        if len(stk) > 0:
            stk.pop()
    else:
        stk.append(i)


print("".join(stk))
# Judge status: Accepted
import sys
N = int(sys.stdin.readline().rstrip())
sec = []

for _ in range(N):
    x, l = map(int, sys.stdin.readline().rstrip().split())
    sec.append((x - l, x + l))

sec = sorted(sec, key=lambda x: x[1])
r = -10**10
ans = 0
for s, t in sec:
    if r <= s:
        ans += 1
        r = t
print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3

S = list(input())
if len((set(S))) == 1 and len(S)!=1:
    print('NO')
    exit()

a_count = S.count('a')
b_count = S.count('b')
c_count = S.count('c')

if a_count == b_count or a_count == c_count or b_count == c_count:
    print('YES')
elif a_count != b_count and a_count != c_count and a_count !=0 and b_count !=0 and c_count != 0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    cnt = 0
    i = 0
    for i in range(N):
        if P[i] == i+1:
            if i+1 >= N:
                P[i],P[i-1] = P[i-1],P[i]
            else:
                P[i],P[i+1] = P[i+1],P[i]
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,q = map(int,input().split())
S = input()
for _ in range(q):
  l,r = map(int,input().split())
  A = S[l:r+1]
  cnt = A.count('AC')
  print(cnt)