peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
#!python3

# input
N = int(input())
S = [input() for _ in range(N)]


def main():
    l = ["AC", "WA", "TLE", "RE"]
    d = {x: 0 for x in l}
    for s in S:
        d[s] += 1
    for x in l:
        ans = "{} x {}".format(x, d[x])
        print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,m,k = map(int,input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ac = 0
bc = 0
ans = 0
t = 0
while t<k:
  if bc<=m-1 and ac <=n-1:
    if a[ac] > b[bc]:
      t += b[bc]
      bc +=1
    else:
      t+= a[ac]
      ac+=1
  elif ac >= n and bc<=m-1:
    t += b[bc]
    bc +=1
    print(t)
  elif bc == m and ac<=n-1:
    t+= a[ac]
    ac+=1
  else:
      break
  ans+=1

print(ans)
# Judge status: Accepted
import math
A,B,N=map(int,input().split())

if B >N:
  print(math.floor((A*N)/B))
else:
  print(math.floor((A*(B-1)/B)))
# Judge status: Accepted
import sys
S = input()

odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

for i, j in enumerate(S):
    if i % 2 == 0:
        if not j in odd:
            print('No')
            sys.exit()
    else:
        if not j in even:
            print('No')
            sys.exit()
print('Yes')
# Judge status: Wrong Answer
n = int(input())

if n % 2 == 0:
  print(n/2)
else:
  print(n//2+1)
# Judge status: Wrong Answer
N = int(input())
S = list(input())
x = [0]
for i in range(N):
  if S[i] == 'I':
    x.append(x[-1]+1)
    print(x)
  elif S[i] == 'D':
    x.append(x[-1]-1)
    print(x)
print(max(x))
# Judge status: Accepted
a,b,n=map(int,input().split())
def f(x):
    return int(a*x//b)-a*int(x//b)
if n<b:
    print(f(n))
elif n==b:
    print(f(n-1))
elif n>b:
    t = n
    u = n - (n%b+1)
    print(max(f(t),f(u)))
# 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: Wrong Answer
X = int(input())
Sum = 0
t = 0
while Sum + (t + 1) <= X:
    t += 1
    Sum += t
print(t + (X - Sum))
# Judge status: Accepted
import math
N,K,*A=map(int,open(0).read().split())

print(int(math.ceil((N-1)/(K-1))))
# Judge status: Wrong Answer
from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
print(ans)
# Judge status: Accepted
if int(input()[5:7])<5:
  print("Heisei")
else:
  print("TBD")
# Judge status: Accepted
k = int(input())
ans = -1
seq = [0]

seq.append(7%k)
for i in range(2,k+1):
  seq.append((seq[i-1]*10+7)%k)

for j in range(1,k+1):
  if seq[j] == 0:
    ans = j
    break

print(ans)
# Judge status: Accepted
N,x = map(int,input().split())
a=list(map(int,input().split()))
cnt=0
b=[0]*N

#0,2
b[0]=a[0] if a[0]<=x else x
cnt+= a[0]-b[0]

for i in range(1,N):
  b[i] = a[i] if b[i-1]+a[i]<=x else max(0,x-b[i-1])
  cnt += a[i]-b[i]
  
#print(b)
print(cnt)
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for _ in range(n)]
now = a[0]
c = 1

if now == 2:
    print(1)
    exit()

for i in range(n):
    now = a[now-1]
    c += 1
    if now == 2:
        print(c)
        break
print(-1)
# Judge status: Accepted
s=input()
t=input()
for i in range(len(s)):
    s=s[-1]+s[0:-1]
    if s==t:
        print("Yes")
        exit()
print("No")
# Judge status: Wrong Answer
N = int(input())
S =[input() for _ in range(N)]
A = [S.count(S[i]) for i in range (N)]
Max_A = max(A)
ans = []
for j in range(N):
    if S.count(S[j]) == Max_A:
        ans.append(S[j])
ans = set(ans)
ans = list(ans)
ans.sort
for k in ans:
    print(k)
# Judge status: Wrong Answer
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

A,B,C = MI()
if A <= C <= B:
    print('Yes')
else:
    print('NO')
# Judge status: Wrong Answer
from collections import Counter
def prime_factorize(n):
    f = 2
    primes = []
    while f * f <= n:
        if n % f != 0:
            f += 1
            continue
        primes.append(f)
        n //= f
    if n > 1:
        primes.append(n)
    return primes
a, b = map(int, input().split())
ab_primes = Counter(prime_factorize(a) + prime_factorize(b))
ans = 0
for prime in ab_primes.values():
    if prime > 1:
        ans += 1
print(1 + ans)
# Judge status: Wrong Answer
N = int(input()) #1行目のNを取得する
Input = list(map(int, input().split()))

Stock = 0
Money = 1000
  
for i in range(N):
  j = i + 1
  
  if j == 1:
    if Input[i] < Input[i+1]:
      Stock = Money // Input[i]
      Money = Money % Input[i]
     
    continue
   
  if j == N:
    if Stock != 0:
      Money = Money + Stock * Input[i]
    continue
  
  if Input[i - 1] < Input[i]:
    Money = Money + Stock * Input[i]
  
  if Input[i + 1] > Input[i]:
    Stock = Money // Input[i]
    Money = Money % Input[i]

    
print(Money)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())

if A%2 == B%2 == C%2 == 0:
    print(0)
else:
    if A%2 == 1:
        red = (A//2+1) * B * C
        blue = (A//2) * B * C
        print(red - blue)
    elif B%2 == 1:
        red = (B//2+1) * A * C
        blue = (B//2) * A * C
        print(red - blue) 
    elif C%2 == 1:
        red = (C//2+1) * A * B
        blue = (C//2) * A * B
        print(red - blue)
# Judge status: Wrong Answer
print("test")
print("test")
print("test")
print("test")
print("test")
print("test")
print("test")
print("test")
print("test")
print("test")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

alice = 0
bob = 0

for i in range(n):
    if (i % 2) == 0:
        alice += a[i]
    else:
        bob += a[i]


print(alice - bob)
# Judge status: Wrong Answer
S=int(input())
count=1
while(1):
	if S==4:
		print(count+3)
		exit()
	elif S%2==0:
		count+=1
		S=S//2
	elif S%2==1:
		count+=1
		S=3*S+1
# Judge status: Accepted
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int):
    print(min(B // A, C))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if b<=c or d<=a:
  print(0)
else:
  x=set([i for i in range(a,b)])
  y=set([i for i in range(c,d)])
  z= x & y
  print(len(z))
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = set([int(input()) for _ in range(m)])

f = [0] * (n + 1)

f[0] = 1
f[1] = 1

for i in range(2, n + 1):
    if i in a:
        f[i] = 0
    else:
        f[i] = f[i - 1] + f[i - 2]

print(f[n] % 1000000007)
# Judge status: Accepted
s = input()
if ("L" in s[::2]) or ("R" in s[1::2]):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n  = int(input())
if n >= 30:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
ans = n // 11
m = n % 11

ans *= 2
if m > 6:
    ans += 2
else:
    ans += 1
print(ans)
# Judge status: Accepted
num = int(input())
if num % 10 == 0:
    ans = 10
else:   
    s = str(num)
    array = list(map(int, s))
    ans = sum(array)
print (ans)
# Judge status: Wrong Answer
import bisect
N, *A = map( int, open( 0 ).read().split() )
L = [ A[ 0 ] ]
for a in A[1:]:
  kr = bisect.bisect_right( L, a )
  if ( kr != 0 ) and ( a != L[ kr -1 ] ):
    L[ kr - 1 ] = a
  else:
    L.insert( kr, a )
print( len( L ) )
# Judge status: Wrong Answer
a, b = map(int, input().split())
ans = 0
for i in range(a,b):
    key = str(i)
    #print(key)
    if key[:2] == key[4]+key[3]:
        ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
s = [list(map(int, input().split())) for i in range(n)]

kukan=[[s[i][0]-s[i][1], s[i][0]+s[i][1]] for i in range(n)]
kukan.sort(key=lambda x:x[1])

count=1
mae=kukan[0][1]
for i in range(1,n):
    if kukan[i][0]>=mae:
        count+=1
        mae=kukan[i][1]

print(count)
# Judge status: Accepted
def solve():
    A, B, K = [int(i) for i in input().split()]
    for i in range(A, B + 1):
        if i < A + K or i > B - K:
            print(i)

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
def I(): return int(input())
n = I()
ans = 0
if n>=105:
    for i in range(105,n+1,2):
        cnt=0
        for j in range(1,int(n**0.5)+1):
            if i % j ==0:
                cnt+=2
        if cnt==8:ans+=1
print(ans)
# Judge status: Accepted
from decimal import *

str = input().split()
A = Decimal(str[0])
B = Decimal(str[1])

print((A*B).quantize(Decimal('0'), rounding=ROUND_DOWN))
# Judge status: Accepted
s = int(input())
l = [s]
#listにappend・同じ数字あるか探す
while True:
  if s%2 == 0:
    s = s//2
    l.append(s)
  else:
    s = 3*s+1
    l.append(s)
  if l.count(s) == 2:
    break
    
print(len(l))
# Judge status: Accepted
N, ans = int(input()), []
while N > 0:
    N = N - 1
    ans.append(chr(N % 26 + ord('a')))
    N = (N - N % 26) // 26
print(''.join(ans[::-1]))
# Judge status: Accepted
from sys import stdin
rs = stdin.readline
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    X = ri()
    money = 100
    month = 0
    while money < X:
        money += money // 100
        month += 1
    print(month)
    
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
X, Y = map(int, input().split())
if Y % X == 0 or X % Y == 0:
  ans = -1
else:
  ans = X
if ans > 10**18:
  ans = -1
print(ans)
# Judge status: Wrong Answer
A,B,K=map(int,input().split())

if A>=K:
    print(A-K,B)
else:
    print(0,max(0,B-K))
# Judge status: Wrong Answer
n,d = map(int, raw_input().split(' '))
print (n +d - 1)/ d
# Judge status: Accepted
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a = INT()
s = input()

print("red" if a<3200 else s)
# Judge status: Wrong Answer
def main():
    n, *s = map(int, open(0).read().split())
    s.sort()
    t = sum(s)
    if t % 10 != 0:
        print(t)
        exit()
    for i in s:
        t -= i
        if t % 10 != 0:
            print(t)
            break
    else:
        print(0)


if __name__ == '__main__':
    main()
# Judge status: Accepted
def resolve():
    n = int(input())
    monster = [int(i) for i in input().split()]
    damage = [int(i) for i in input().split()]

    before = sum(monster)
    for i, (mst, dmg) in enumerate(zip(monster, damage)):
        if dmg >= monster[i]:
            _dmg = dmg - monster[i]
            monster[i] = 0
            monster[i + 1] = max(monster[i + 1] - _dmg, 0)
        else:
            monster[i] = monster[i] - dmg

    after = sum(monster)
    print(before - after)


resolve()
# Judge status: Accepted
S = input()
 
A = 'x'*(len(S))
print(A)
# Judge status: Accepted

def check(s: str) -> bool:
    ls = len(s)
    if ls % 2 != 0:
        return False
    else:
        if "".join(s[:ls//2]) == "".join(s[ls//2:]):
            return True


s = input()
l = len(s)
ans = 0
for i in reversed(range(l-1)):
    if check(s[0:i + 1]):
        ans = i+1
        break

print(ans)
# Judge status: Accepted

S = input()
N = len(S)

a = S[0:(N-1)//2]
b = S[N - (N-1)//2::]

if a == b: print("Yes")
else: print("No")
# Judge status: Wrong Answer
X = int(input())

#500
X_500 = X // 500 * 2
#5
X_5 = (X % 500) // 5

print(X_500 + X_5)
# Judge status: Accepted
A, B, C = map(int, input().split())
V = sorted([A, B, C])
ans = 'Yes' if V[1] == C else 'No'
print(ans)
# Judge status: Wrong Answer
x = int(raw_input())
print 'YES' if x >= 3 else 'NO'
# Judge status: Accepted
n, m = map(int, input().split())

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
n, m = map(int, input().split())
cnt = [0] * n
for _ in range(m):
    a, b = map(int, input().split())
    cnt[a - 1] += 1
    cnt[b - 1] += 1
print(*cnt, sep='\n')
# Judge status: Accepted
X,Y = map(int,input().split())
mod = 10**9+7
N = (X+Y)//3
M = (N+X-Y)//2

if (X+Y)%3!=0 or M<0 or N<M:
  print(0)
else:
  ans = 1
  for m in range(1,M+1):
    ans*=(N-M+m)*pow(m,mod-2,mod)
    ans%=mod
  print(ans)
# Judge status: Accepted
[N, L] = list(map(int, input().split()))
list_N = []
for i in range(N):
  list_N.append(input())
list_N.sort()
print("".join(list_N))
# Judge status: Accepted
def solve():
    n = int(input())
    a = tuple(map(int,input().split()))
    cnt = [0]*1000000
    for i in a:
        if i!=0:
            cnt[i-1]+=1
        cnt[i]+=1
        cnt[i+1]+=1
    mx = (0,0)
    for i in range(100100):
        if cnt[i]>mx[0]:
            mx = (cnt[i],i)
    print(mx[0])
if __name__ == "__main__":
    solve()
# Judge status: Accepted
s = list(input())
t = list(input())
l1 = len(s)
l2 = len(t)
ans = []
for i in range(l1-l2+1):
    s1 = s[:]
    for j in range(l2):
        if s1[i+j] == "?":
            s1[i+j] = t[j]
        elif s1[i+j] != t[j]:
            break
    else:
        s1 = "".join(s1)
        s1 = s1.replace("?","a")
        ans.append(s1)
if ans:
    ans.sort()
    print(ans[0])
else:
    print("UNRESTORABLE")
# Judge status: Wrong Answer
a,b,c = map(int,(input().split()))
l = [a,b,c]
if int(l.count(5)) == 2 and int(l.count(7)) == 1:
	print(True)
else:
	print(False)
# Judge status: Accepted
input = int(input())

flag = False
for num in range(1, 10):
  q, mod = divmod(input, num)
  if(q <= 9 and mod == 0):
    flag = True
    break
    
if(flag):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
k = int(input())

x = 7

for i in range(k):
    if x%k==0:
        print(i+1)
        exit()
    x = (x*10 + 7)%k
print("-1")
# Judge status: Wrong Answer
N = int(input())


def solve(N):
    if N == 1:
        return ["a"]
    result = []
    for s in solve(N-1):
        result.append(s+'a')
        result.append(s+'b')
    return result

for s in sorted(solve(N)):
    print(s)
# Judge status: Accepted
a,b,c = map(int, input().split())
print(max(0,c-(a-b)))
# Judge status: Accepted
k,a,b=map(int,input().split())

if b-a<=2:
    print(k+1)
else:
    print(max(k+1,(k-a+1)//2*(b-a)+(k-a+1)%2+a))
# Judge status: Accepted
H, W = map(int, input().split())
if H == 1 or W == 1:
    print(1)
elif H % 2 == 0 or W % 2 == 0:
    print(H * W // 2)
else:
    print((H - 1) * (W - 1) // 2 + (H - 1) // 2 + (W - 1) // 2 + 1)
# Judge status: Accepted
a = int(input())
print(a+ a**2 + a**3)
# Judge status: Wrong Answer
n = int(input())
a = list(map(str,input().split()))
ans = 'YES'
for i in range(n):
    if a.count(a[i]) != 1:
        ans = 'NO'
    break
print(ans)
# Judge status: Accepted
a,b,c,k = map(int,input().split())

if a >= k:
    print(k)
elif a+b >= k:
    print(a)
else:
    k -= (a+b)
    print(a-k)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	a = inputInt()

	print(a + a**2 + 2**3)



#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()
# Judge status: Accepted
from fractions import gcd
import sys

n, m = map(int, input().split())
a = list(map(int, input().split()))
a = [i // 2 for i in a]

cnt = 1
min_a = min(a)
while min_a % 2 == 0:
    cnt *= 2
    min_a = min_a // 2

ans = 1
for i in a:
    if (i // cnt) % 2 == 0:
        print(0)
        sys.exit()
    ans = (ans * i) // gcd(ans, i)

print((m//ans+1)//2)
# Judge status: Accepted
K, X = [int(x) for x in input().split()]
print('Yes' if K*500 >= X else 'No')
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

res = ""
res += "U" * (ty - sy) + "R" * (tx - sx)
res += "D" * (ty - sy) + "L" * (tx - sx)
res += "L" + "U" * (ty - sy + 1) + "R" * (tx - sx + 1) + "D"
res += "R" + "D" * (ty - sy + 1) + "L" * (tx - sx + 1) + "U"

print(res)
# Judge status: Accepted
N = int(input())
S = input()

sl_E = []
sl_W = []
for i, s in enumerate(S):
    E = 1 if s == "E" else 0
    W = 1 if s == "W" else 0
    s_E = sl_E[i - 1] + E if i != 0 else E
    s_W = sl_W[i - 1] + W if i != 0 else W
    sl_E.append(s_E)
    sl_W.append(s_W)

_min = sl_E[-1]
for i in range(1, N):
    count = sl_W[i - 1]
    count += sl_E[-1] - sl_E[i]
    if count < _min:
        _min = count

print(_min)
# Judge status: Wrong Answer
a,b=map(int,input().split())
c=list(map(int,input().split()))
print(c)
d=sorted(c)
ans=0
for i in range(0,b):
 ans+=d[i]
print(ans)
# Judge status: Accepted
N, C, K = map(int, input().split())
T = sorted(map(int, (input() for _ in range(N))))
ans = 0
count = 0
bus = None
for t in T:
    tk = t + K
    if bus is None or bus < t or count + 1 > C:
        bus = tk
        count = 0
        ans += 1
    count += 1
print(ans)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
h_list = input().split()
h_list = [int(h) for h in h_list]

count = 0

for i in range(n):
    a_height = h_list[i]
    if i + 21 < n:
        n_aa = i + 21
    else:
        n_aa = n
    for k in range(i + 1 + a_height, n_aa):
        b_height = h_list[k]
        if k - i == a_height + b_height:
            count += 1

print(count)
# Judge status: Wrong Answer
N, M = map(int, input().split())

PY = [list(map(int, input().split())) + [i] for i in range(M)]

PY.sort(key=lambda x: (x[0], x[1]))

prev_p, i = PY[0][0], PY[0][2]
out = [None] * len(PY)
out[i] = str(prev_p).zfill(6) + str(1).zfill(6)

cnt = 1
for p, _, idx in PY[1:]:
    if p != prev_p:
        cnt = 0

    cnt += 1
    prev = p
    out[idx] = str(p).zfill(6) + str(cnt).zfill(6)


for x in out:
    print(x)
# Judge status: Wrong Answer
l=int(input())
ans=0
sum=0
 
for i in range(l):
 for j in range(l):
   sum=i*j*(l-i-j)
   if ans>sum:
      ans=sum
print(ans)
# Judge status: Accepted
inf = 10**9


def calcDistance(p1,p2):
  return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])

def calcNearestCheckpoints(person,checkpoints):
  ans = -1
  min_distance = inf
  for i in range(len(checkpoints)):
    distance = calcDistance(person,checkpoints[i])
    if distance < min_distance:
      ans = i+1
      min_distance = distance

  return ans

def main():
  N,M = map(int,input().split())
  people      = [list(map(int,input().split())) for _ in range(N)]
  checkpoints = [list(map(int,input().split())) for _ in range(M)]
  for i in range(N):
    person = people[i]
    print(calcNearestCheckpoints(person,checkpoints))

main()
# Judge status: Accepted
a, b = map(int, input().split())

l = ['{}'.format(a)*b, '{}'.format(b)*a]
l.sort()
print(l[0])
# Judge status: Accepted
import collections
 
n = int(input())
 
res = []
 
for _ in range(n):
  res.append(input())
 
c = collections.Counter(res)
aa = c.most_common()
 
ss = aa[0][1]
res2 = []
 
aa.sort()
for i in aa:
  if i[1] == ss:
    res2.append(i[0])
    print(i[0])
# Judge status: Wrong Answer
l=['Sunny','Cloudy','Rainy'];print(l.index(input())-1)
# Judge status: Accepted
a,b=map(int,input().split(" "))
print([0,1][a%b>0])
# Judge status: Accepted
from collections import Counter

def main():
    n = int(input())
    s = Counter(input())
    for _ in range(n-1):
        s &= Counter(input())
    print("".join(sorted(s.elements())))
    
main()
# Judge status: Wrong Answer
h,a=map(int,input().split())

ans=0
while h>=0:
    h-=a
    ans+=1


print(ans)
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()
d = [0, 0]
for i in range(N - 1):
    if S[i] + S[i + 1] == "AC":
        d.append(d[-1] + 1)
    else:
         d.append(d[-1])

for _ in range(Q):
    l, r = map(int, input().split())
    print(d[r] - d[l])
# Judge status: Wrong Answer
q,h,s,d=map(int,input().split())
n=int(input())
h,s,d=min(h,q*2),min(s,h*2),min(d,s*2)
print (d*(n//2)+s*(n%2))
# Judge status: Wrong Answer
D, N = map(int, input().split())
print(100**D*N)
# Judge status: Accepted
s = input()
if 'RRR' in s:
  print(3)
elif 'RR' in s:
  print(2)
elif 'R' in s:
  print(1)
else:
  print(0)
# Judge status: Wrong Answer
a,b=map(int,input().split())
A=str(a)
B=str(b)
num_1=int(A*b)
num_2=int(B*a)
if num_1>num_2:
  print(num_2)
elif num_1<num_2:
  print(num_1)
elif num_1==num_2:
  print(num_1)
# Judge status: Accepted
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import Counter

n=int(input())
d=lnii()

mod=998244353

c=Counter(d)
max_key=max(d)

if d[0]!=0 or c[0]!=1:
  print(0)
  exit()

ans=1
patterns=1
for i in range(max_key+1):
  p_num=c[i]
  ans*=patterns**p_num
  ans%=mod
  patterns=p_num

print(ans)
# Judge status: Accepted
x, y = map(int,input().split())
ans = 0
while 1:
    if x > y:
        break
    else:
        ans += 1
        x *= 2
print(ans)
# Judge status: Accepted
s = int(input())
mod = 10 ** 9 + 7

dp = [1] + [0] * s
for i in range(3, s + 1):
    dp[i] = (dp[i - 1] + dp[i - 3]) % mod
print(dp[s])
# Judge status: Accepted
n = int(input())
s = input()

ans = [0] * n
left = 0
right = s[1:len(s)].count('E')
ans[0] = right

for i in range(1, n):
    if s[i - 1] == 'W':
        left += 1
    if s[i] == 'E':
        right -= 1
    ans[i] = left + right

print(min(ans))
# Judge status: Accepted
import sys
import math
a=0
N=int(input())
i=N
if N==2:
  print(2)
  sys.exit()
elif N==3:
  print(3)
  sys.exit()
elif N==4:
  print(5)
  sys.exit()
elif N==5:
  print(5)
  sys.exit()
while True:
  c=int(math.sqrt(i))
  for j in range(2,c+1):
    if i%j==0:
      a+=1
      break
  if a==0:
    print(i)
    sys.exit()
  a=0
  i=i+1
# Judge status: Accepted
x = input()
print("vowel" if "aeiou".count(x)==1 else "consonant")
# Judge status: Wrong Answer
def main():
    s = list(input())
    k = int(input())

    for i in range(len(s)):
        mod = 26-(ord(s[i])-97)%26
        if k >= mod:
            k -= mod
            s[i] = 'a'
        if k == 0:
            break
    
    if k > 0:
        mod = ((ord(s[-1])-97)+k)%26
        s[-1] = chr(mod+97)
    print(''.join(s))

if __name__ == '__main__':
    main()
# Judge status: Accepted
import itertools

def issquare(x):
    a = 1
    while x >= a*a:
        if x == a*a:
            return True
        a += 1
    return False

n,d = map(int, input().split())
ps = [list(map(int, input().split())) for _ in range(n)]

ans = 0
for pi,pj in itertools.combinations(ps, 2):
    d = sum([(x-y)*(x-y) for x,y in zip(pi,pj)])
    if issquare(d):
        ans += 1
print(ans)
# Judge status: Wrong Answer
ls=[]

for i in range(3):
  ls.append(input())

l=[]

for i in range(3):
  l.append(int(ls[i]))
  
print((l[0]+l[1])*l[2]/2)
# Judge status: Accepted
s = input()
for i in range(3):
  if s[i] == s[i+1]:
    print('Bad')
    exit()
    
print('Good')
# Judge status: Wrong Answer
n,m = [int(x) for x in input().split()]
xy = []
for _ in range(m):
    tmp = [int(x) for x in input().split()]
    xy.append(tmp)

r = [1]
d = {x: 1 for x in range(1,n+1)}

for v in xy:
    d[v[0]] -= 1
    d[v[1]] += 1
    if v[0] in r:
        r.append(v[1])
    if d[v[0]] == 0 and v[0] in r:
        r.remove(v[0])

R = set(r)
ans = 0
for x in d.keys():
    if d[x] > 0 and x in R:
        ans += 1
print(ans)
# Judge status: Accepted
if __name__ == '__main__':
    t = list(input())

    t[3] = '8'
    print(''.join(t))