peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
p = 0
n, a, b = map(int, input().split())
for i in input():
    if i == "a" and p > a+b:
        p += 1
        print("Yes")
    elif i == "b" and p > a+b and f > a+b:
        f += 1
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
n, k = map(int,input().split())
h =[int(input()) for i in range(n)]
h.sort()
ans = 100000000

for i in range(len(h)-k+1):
    if h[i+k-1] - h[i] < ans:
        ans = h[i+k-1] - h[i]
        if ans == 0:
            break

print(ans)
# Judge status: Wrong Answer
A = 1
B = 2
C = 3

A,B,C, = B,C,A

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

if M >= N:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N=int(input())
s=input()
t=input()
overlap1=0
for i in range(N):
    if s[i]==t[N-i-1]:
        overlap1+=1
    else:
        break
overlap2=0
for i in range(N):
    if t[i]==s[N-i-1]:
        overlap2+=1
    else:
        break
print(N if s==t else 2*N-max(overlap1,overlap2))
# Judge status: Accepted
def d_lunlun_number():
    from collections import deque
    K = int(input())

    queue = deque(range(1, 10))
    ans = -1
    for _ in range(K):
        ans = queue.popleft()
        lsd = ans % 10  # least significant digit
        if lsd != 0:
            queue.append(10 * ans + (lsd - 1))
        queue.append(10 * ans + lsd)
        if ans % 10 != 9:
            queue.append(10 * ans + (lsd + 1))
    return ans

print(d_lunlun_number())
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
q = int(input())

ans = sum(a)
numbers = [0]*(10**5+1)
for v in a:
    numbers[v] += 1

for _ in range(q):
    b,c = [int(i) for i in input().split()]
    nb = numbers[b]
    ans += (c-b)*nb
    print(ans)
    numbers[b] = 0
    numbers[c] += nb
# Judge status: Accepted
# coding: utf-8
# Your code here!
A,B,K=map(int,input().split())

if A<=K:
    K-=A
    A=0
    if B<=K:
        print(0, end=' ')
        print(0)
    else:
        B-=K
        print(A,end=' ')
        print(B)

else:
    A-=K
    print(A,end=' ')
    print(B)
# Judge status: Accepted
N, W = map(int, input().split())
goods = [list(map(int, input().split())) for _ in range(N)]

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

for i in range(N):
    for w in range(W+1):
        if w-goods[i][0] >= 0:
            dp[i+1][w] = max(dp[i+1][w], dp[i][w-goods[i][0]] + goods[i][1])
        dp[i+1][w] = max(dp[i+1][w], dp[i][w])        
print(dp[-1][-1])
# Judge status: Accepted
import numpy as np


n = int(input())
l = [[0] * (ord('z') - ord('a') + 1) for _ in range(n)]
for i in range(n):
    S = input()
    for s in S:
        idx = ord(s) - ord('a')
        l[i][idx] += 1
l = np.array(l)
l = np.rot90(l, -1)
ans = ''
for j in range(len(l)):
    num = min(l[j])
    ans += chr(ord('a') + j) * num
print(ans)
# Judge status: Wrong Answer
# -*- coding:utf-8 -*-
s = input()
count = 0
for i in range(len(s)):
  a = s[i]
  b = s[::-1][i]
  if a != b:
    count += 1
print(int(count/2))
# Judge status: Wrong Answer
N = int(input())

x = N * 800
y = (x // 15) * 200

print(x - y)
# Judge status: Accepted
n,k=map(int,input().split())
loop_=[1]
l_set=set()
lst=list(map(int,input().split()))

tar=None
for i in range(k):
    num=lst[loop_[-1]-1]
    if num in l_set:
        tar=num
        break
    else:
        loop_.append(num)
        l_set.add(num)

if tar==None:
    print(loop_[k])
    exit()    
loop__=loop_[loop_.index(tar):]

num=k+1-len(loop_)
try:
  print(loop__[num%len(loop__)-1])
except:
  print(1)
# Judge status: Accepted
a,b=map(int,input().split())
print("10"[a%b==0])
# Judge status: Wrong Answer
N, M = map(int,input().split())

AB = {}
for i in range(N):
  A, B = map(int,input().split())
  AB[A]=B
AB = sorted(AB.items(),key = lambda x:x[0])

cost = 0

for a,b in AB:
  cost += (min(max(M,0),b))*a
  M-=b
  if M<=0:
    break
print(cost)
# Judge status: Wrong Answer
n = int(input())

if n <= 9:
  print(n)
  
n -= 9
t = n % 3
cnt = 0

while True:
  n //= 3
  cnt += 1
  
  if n < 3:
    break
   
if t == 0:
  print(n*10 + n+1)
else:
  print((n+1)*10 + (n+1)-(2-t))
# Judge status: Accepted
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        if i % 2 != 0 and len(divisor(i)) == 8:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
#!/usr/bin/env python

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

if a == b == c:
    print(-1)
    exit()

ans = 0 
while True:
    ta = a 
    tb = b 
    tc = c 
    a = (tb+tc)//2
    b = (tc+ta)//2
    c = (ta+tb)//2
    ans += 1
    if a%2 == 1 or b%2 == 1 or c%2 == 1:
        print(ans)
        exit()
# Judge status: Wrong Answer
a = input('')
b = input('')
num = b.split(' ')
price = int(a.split(' ')[0])
f = False
for i in range(price, 10000):
	for j in range(len(str(i))):
		if str(i)[j] in num:
			break
	else:
		break
print(i)
# Judge status: Accepted
x = int(input())
while True:
  flg = True
  for i in range(2,x):
    if x % i == 0:
      flg = False
      break
  if flg == True: break
  x += 1
print(x)
# Judge status: Wrong Answer
import itertools
N=int(input())
XY=[]
for i in range(N):
  x,y=map(int,input().split())
  XY+=[[x,y]]
ALL=list(itertools.permutations(XY))
print(ALL)
ans=10**9
d=0
for i in ALL:
  for k in range(N-1):
    d2=((i[k][0]-i[k+1][0])**2+(i[k][1]-i[k+1][1])**2)**(1/2)
    d+=d2
ans=d/len(ALL)
print(ans)
# Judge status: Accepted
import numpy as np
N=int(input())
six=[1]
nine=[]
for i in range(1,N):
  six.append(6**i)
  nine.append(9**i)
  if 6**i>N:
    break
six=np.array(six)
nine=np.array(nine)
L=np.concatenate([six,nine])    
now=N
count=0
dp=np.ones(N+L.max()+1)*10**9
dp[1]=1
dp[0]=0
#dp[i+1]　iをちょうど引き出すのに必要な最小回数
for i in range(1,N):
  dp[i+1]=(dp[i-L+1]+1).min()

  
print(int(dp[N]))
#print(len(L))
# Judge status: Accepted
import sys

n = int(input())
a = [num for num in map(int, input().split())]

# print(n)
# print(a)

for item in a:
  if item % 2 == 1:
    continue
  if item % 3 == 0 or item % 5 == 0:
    continue
  print('DENIED')
  sys.exit()
print('APPROVED')
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=0
while s<n-1:
  if m>=a[s]:
    m-=a[s]
    s+=1
  else:break
print(s)
# Judge status: Accepted
# coding: utf-8
N = int(input())
d = {}
alp = "abcdefghijklmnopqrstuvwxyz"
cnt = {}
for s in alp:
    cnt[s] = 0
for i in range(N):
    d[i] = {}
    s = input()
    for j in range(len(alp)):
        d[i][alp[j]] = 0
    for j in range(len(s)):
        d[i][s[j]] += 1
for s in alp:
    l = []
    for k in d.keys():
        l.append(d[k][s])
    cnt[s] = min(l)
ans = ""
# print(cnt)
for a in alp:
    ans += a * cnt[a]
print(ans)
# Judge status: Wrong Answer
a = input()
alpha = ["a", "b", "c", "d", "e", "f", "g",
         "h", "i", "j", "k", "l", "m", "n",
          "o", "p", "q", "r", "s", "t", "u",
        "v", "w", "x", "y", "z"]

for i in alpha:
    if a == alpha:
        print(alpha[i+1])
        break
# Judge status: Wrong Answer
n = int(input())
a = sorted(list(map(int, input().split())))

r = sum(a)
l = 0
sub = 10 ** 19 + 101
for i in range(n):
    r -= a[i]
    l += a[i]
    # print(l, r,sub)
    if n == 2:
        print(abs(r - l))
        exit()
    elif abs(r - l) > sub:
        print(tmp)
        exit()
    else:
        sub = min(sub, abs(r - l))
        tmp = abs(r - l)
# Judge status: Accepted
n,k=map(int,input().split())
cnt=0
while n:
    cnt+=1
    n//=k
print(cnt)
# Judge status: Wrong Answer
N,K=input().split()
n,k=int(N),int(K)
p=list(input().split())

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

pre=[0 for i in range (n+1)]
q=[0 for i in range (n-k+100)]


pre[0]=p[0]
for i in range(n):
    pre[i+1]=pre[i]+p[i]

for i in range(1,n-k+1):
    q[i]=pre[i+k]-pre[i]
   
ans=max(q)

print ((ans + k) / 2)
# Judge status: Accepted
N = int(input())
A = sorted(list(map(int, input().split())))

import math

n = A.pop()
P_dif_A = sorted([[abs(a-n/2), a] for a in A])
r = P_dif_A[0][1]

print(n, r)
# Judge status: Wrong Answer
N = int(input())
ans = 0

for i in range(N):
    if i % 15 == 0:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        ans += i
        
print(ans)
# Judge status: Accepted
n,m = map(int, input().split())
As = [list(input()) for i in range(n)]
Bs = [list(input()) for i in range(m)]

for i in range(n-m+1):
    for j in range(n-m+1):
        cut = []
        for k in range(m):
            cut.append(As[j+k][i:i+m])
        # print(i,j,cut)
        if cut == Bs:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
X = int(input())

def gcd(a, b):
  if a == 0:
    return b
  else:
    return gcd(b%a, a)

print(360*X//gcd(X, 360)//X)
# Judge status: Accepted
n=int(input()) 
s=[]
for i in range(2,int(n**0.5)+1):
    if n%i==0:
        p=0
        while(n%i==0):
            p+=1
            n//=i
        s.append(p)
if n>1:
    s.append(1)
#1print(s)
ans=0
for i in s:
    r=1
    while(i>0):
        if i<r:
            break
        i-=r 
        r+=1
        ans+=1 
print(ans)
# Judge status: Accepted
N=int(input())
global key
key="abcdefghij"
def normal(N):
    if N==1:
        return ["a"]
    else:
        new=[]
        lis=normal(N-1)
        for s in lis:
            i=0
            while key[i] in s:
                new.append(s+key[i])
                i+=1
            new.append(s+key[i])
    return new
lis=normal(N)
for s in lis:
    print(s)
# Judge status: Accepted
from collections import deque
n,m = map(int,input().split())

adj = [[] for _ in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    adj[a].append(b)
    adj[b].append(a)

que = deque()
dist = [-1]*n
ans = [0]*n

que.append(0)
while len(que) != 0:
    now = que.popleft()
    for to in adj[now]:
        if dist[to] != -1: continue
        dist[to] = dist[now]+1
        que.append(to)
        ans[to]=now

print("Yes")
for i in range(1,n):
    print(ans[i]+1)
# Judge status: Wrong Answer
# C - Monsters Battle Royale

N = int(input())
A = list(int(x) for x in input().split())
A.sort()

ans = A[0]
for i in range(1, N):
    tmp = A[i]%ans
    if tmp != 0:
        ans = tmp
    else:
        continue
print(ans)
# Judge status: Wrong Answer
N, M = map(int, input().split())
a = []
b = []
for i in range(M):
    a1 , b1 = [int(i) for i in input().split()]
    a.append(a1)
    b.append(b1)

nm = a+b

ans = [0 for i in range(N)]
for j in range(0,(len(nm))):
    i = nm[j]
    ans[i-1] += 1


print(ans)
# Judge status: Accepted
n,c,k=map(int,input().split())
t=[0 for i in range(n)]
for i in range(n):
    t[i]=int(input())
t.sort()
ans=0
cnt=1
bef=t[0]
for i in range(1,n):
    if cnt==c:
        ans+=1
        cnt=1
        bef=t[i]
    elif bef+k>=t[i] and cnt<c:
        cnt+=1
    else:
        ans+=1
        cnt=1
        bef=t[i]
    if i==n-1:
        ans+=1
print(ans)
# Judge status: Accepted
A,B,C = map(int,input().split())
if A*B*C % 2 == 0:
    print(0)
else:
    print(min(min(A*B,B*C),C*A))
# Judge status: Accepted
a, b = map(int, input().split())

if abs(a+b)%2 == 0:
  print(abs(a+b)//2)
else:
  print('IMPOSSIBLE')
# Judge status: Wrong Answer
n = int(input())
address = list(map(int, input().split()))
sort_address = sorted(address)
sum = 0
sum_min = 100000

for i in range(sort_address[0], sort_address[-1] + 1):
    for j in sort_address:
        sum += (i - j)**2
    if sum < sum_min:
        sum_min = sum
    sum = 0
print(sum_min)
# Judge status: Accepted
#temprate
from sys import setrecursionlimit
setrecursionlimit(10**6)
from collections import Counter
def inputlist(): return [int(j) for j in input().split()]
#temprate
K,A,B = inputlist()
if A >= B:
    print(K + 1)
    exit()

tmp = K - (A - 1)
if tmp < 0:
    print(K + 1)
    exit()
cnt = tmp // 2
amari = tmp % 2

ans = cnt * B - (cnt - 1) * A + amari
ans = max(ans, K + 1)
print(ans)
# Judge status: Accepted
ans=float("INF")
n=int(input())

s=0
for i in range(1,n//2+1):
  ans=min(sum(list(map(int,list(str(i)))))+sum(list(map(int,list(str(n-i))))),ans)
print(ans)
# Judge status: Wrong Answer
import numpy as np

S = input()
T = input()

m = len(S)
n = len(T)

for i in range(m-n, -1, -1):
  if np.prod([s in [t, '?'] for s, t in zip(S[i:i+m], T)]):
    ans = S[:i] + T + S[i+m-1:]
    ans = ans.replace('?', 'a')
    break
else:
  ans = 'UNRESTORABLE'
print(ans)
# Judge status: Accepted
k = int(input())

n = k // 2
if k % 2 == 0:
  print(n**2)
else:
  print(n * (n + 1))
# Judge status: Accepted
S = input()
for i in range(3):
    if S[i] == S[i + 1]:
        print('Bad')
        quit()
print('Good')
# Judge status: Accepted
a, b, c = map(int,input().split())
l = [a,b,c]
l.sort()
if l[0] + l[1] == l[2]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = [-int(input()) for _ in range(N)]

from bisect import bisect_left
lis = [1]
for a in As:
    if a>=lis[-1]:
        lis.append(a)
    else:
        lis[bisect_left(lis, a)-1] = a

print(len(lis))
# Judge status: Wrong Answer
def main():
    N = int(input())
    res = 0
    for i in range(N):
        if i % 3 != 0 and i % 5 != 0:
            res += i
    print(res)


if __name__ == "__main__":
    main()
# Judge status: Accepted
s = input()
k = int(input())

ans = 1
for i in range(k):
    if s[i] != '1':
        ans = s[i]
        break
print(ans)
# Judge status: Accepted
def main():
    n,k = map(int,input().split())
    r,s,p = map(int,input().split())
    t = list(input())
    res = 0
    dic = {'r':p,'s':r,'p':s}

    for i in range(n):
        if i < k or t[i-k] != t[i]:
            res += dic[t[i]]
        else:
            t[i] = ' '
    print(res)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
n = int(input())
a = [2**i for i in range(0,7)]
for i in range(len(a)):
    if n == a[i]:
        print(a[i])
        sys.exit()
    elif n < a[i]:
        print(a[i-1])
        sys.exit()
# Judge status: Accepted
n, m = map(int, input().split())
s = set(range(1, m+1))
for _ in range(n):
    k, *a = map(int, input().split())
    s&=set(a)

print(len(s))
# Judge status: Accepted
#わからんけどとりあえず貪欲
N = int(input())

robots = []
for i in range(N):
    X,L = list(map(int,input().split()))
    robots.append((X-L,X+L))

robots.sort(key=lambda x:x[1])

point = -(10**9)
ans = 0
for i in range(N):
    if point <= robots[i][0]:
        ans += 1
        point = robots[i][1]

print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

AA = [0] * (N)
for i in range(N):
    AA[i] = list(format(A[i], 'b'))

ans = [0] * 42
for i in range(N):
    AA[i].reverse()
    for j in range(len(AA[i])):
        ans[j] += int(AA[i][j])

ret = []
for i in range(N):
    temp = 0
    for j in range(len(AA[i])):
        if (ans[j] - int(AA[i][j])) % 2 == 1:
            temp += 1 << j

    ret.append(temp)

print(*ret)
# Judge status: Wrong Answer
n, d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
ans = 0
def check(i, j):
  d2 = 0
  for k in range(d):
    d2 += (x[i][k] * x[j][k]) ** 2
  for j in range(d2 + 1):
    if j ** 2 > d2:
      return False
    if j ** 2 == d2:
      return True
  return False

for i in range(n):
  for j in range(i + 1, n):
    if check(i, j):
      ans += 1

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

ans  = 0
for i in range(N):
    d1,d2 = map(int, input().split())
    if d1 == d2:
        ans += 1
        if ans == 3:
            print("Yes")
            exit()
    else:
        ans = 0
else:
    print("No")
# Judge status: Wrong Answer
A,B,K=map(int,input().split())
cnt=0
num=1
for i in range((min(A,B)),0,-1):
    if cnt<K:
        if A%i==0 and B%i==0:
            cnt+=1
            num=i
    else:
        break
print(num)
# Judge status: Accepted
N = int(input())

S = []
for _ in range(N):
    S.append(input())
print(len(set(S)))
# Judge status: Wrong Answer
D,N=map(int, input().split())
base=10**(2*D)
print(N*base)
# Judge status: Wrong Answer
def solve(n):
    ans = 0
    for i in range(1,n+1):
        y = n//i
        print(y)
        ans += (y*(y+1)*i)/2
    return ans

def main():
    n = int(input())
    print(int(solve(n)))

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

    cards = [0] * (N + 1)

    for _ in range(M):
        l, r = [int(v) - 1 for v in input().split()]
        cards[l] += 1
        cards[r+1] -= 1

    count = 0
    if cards[0] == M:
        count += 1

    for i in range(1, N+1):
        cards[i] += cards[i - 1]
        if cards[i] == M:
            count += 1

    print(count)


main()
# Judge status: Accepted
p = list(map(int,input().split()))

mn = 200
for i in range(2):
    for j in range(i+1,3):
        if (p[i]+p[j] < mn):
            mn = p[i]+p[j]

print(mn)
# Judge status: Accepted
a,b,c,x,y=map(int,input().split())
p = a*x + b*y
q = 2*c*max(x,y)
r = 2*c*x + b*(y-x)
s = 2*c*y + a*(x-y)
if x >=y:
        print(min(p,q,s))
else:
        print(min(p,q,r))
# Judge status: Wrong Answer
s = input()
t = input()

dic = {}

for i,j in zip(s,t):
    if i == j:
        continue
    if j in dic:
        if dic[j] != i:
            print("No")
            exit()
    else:
        dic[j] = i

print("Yes")
# Judge status: Accepted
n = int(input())
resl = "Yes"
wrds = set()
for i in range(n):
  sng = input()
  if i==0:
    lst = sng[len(sng)-1]
    wrds.add(sng)
  elif sng[0]==lst and (sng not in wrds):
    lst = sng[len(sng)-1]
    wrds.add(sng)
  else:
    resl = "No"
print(resl)
# Judge status: Wrong Answer
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))

dic = []
for i in h:
  b = abs((i - t * 0.006) - a)
  dic.append(b)

print(dic.index(min(dic)) + 1)
# Judge status: Accepted
n = int(input())
s = input()

half = n // 2
if s[:half] == s[half:]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N,M=map(int, input().split())
N_str = []
M_str = []
for i in range(N):
  n=str(input())
  N_str.append(n)
for i in range(M):
  m=str(input())
  M_str.append(m)

equal = False
  
for i in range(N-M+1):
  for k in range(N-M+1):
    each_equal = True
    for l in range(M):
      each_equal = each_equal and (N_str[i+l][k:k+M] == M_str[l])
    equal = each_equal

print(["No","Yes"][equal])
# Judge status: Wrong Answer
W, H, N = map(int, input().split())
w = 0
h = 0
lx = list()
ly = list()
la = list()
for i in range(1, N+1):
    X, Y, A = map(int, input().split())
    lx.append(X)
    ly.append(Y)
    la.append(A)
    if A == 1 and w < X:
        w = X
    elif A == 2 and X < W:
        W = X
    elif A == 3 and h < Y:
        h = Y
    elif A == 4 and Y < H:
        H = Y
S = (W - w)*(H - h)
if S < 0:
    S = 0
print(S)
# Judge status: Accepted
a,b,c,x,y = list(map(int,input().split()))

if 2*c > a+b:
    ans = a*x + b*y
else:
    ans = min(x,y)*2*c+(x-min(x,y))*(min(2*c,a))+(y-min(x,y))*(min(2*c,b))

print(ans)
# Judge status: Accepted
D = {}
N = int(input())
A = list(map(int, input().split()))
Rec = []
Sq = []
for i in A:
  if i in D:
    D[i] += 1
  else:
    D[i] = 1
for i in D:
  if D[i] >= 4:
    Sq.append(i)
  if D[i] >= 2:
    Rec.append(i)
Rec.sort(reverse=True)
if len(Rec) <= 1 and len(Sq) == 0:
  print(0)
elif len(Sq) != 0 and len(Rec) >= 2:
  print(max(Rec[0] * Rec[1], max(Sq) * max(Sq)))
elif len(Sq) == 0 and len(Rec) >= 2:
  print(Rec[0] * Rec[1])
# Judge status: Accepted
import collections
n,k=map(int,input().split())
A=list(map(int,input().split()))
a=collections.Counter(A)
a=a.most_common()
cnt=0
for i in range(len(a)):
  if i>k-1:
    cnt+=a[i][1]
print(cnt)
# Judge status: Wrong Answer
def main():

    import heapq
    x, y, a, b, c = map(int, input().split())
    rlis = list(map(int, input().split()))
    glis = list(map(int, input().split()))
    clis = list(map(int, input().split()))

    lis = []
    rlis.extend(clis)
    glis.extend(clis)
    anslis1 = heapq.nlargest(x,rlis)
    anslis2 = heapq.nlargest(y,glis)
    anslis1.extend(anslis2)

    print(sum(int(i) for i in anslis1))


if __name__ == '__main__':
    main()
# Judge status: Accepted
x = int(input())

if x == 3 or x == 5 or x == 7:
    ans = 'YES'
else:
    ans = 'NO'

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

#条件1を満たす(i,j,k)の組→R,G,Bの選び方
r,g,b = S.count('R'),S.count('G'),S.count('B')

ans = r*g*b

for i in range(N):
    for j in range(i+1,N):
        k = 2*j - i
        if k >= N:
            break
        else:
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
                ans -= 1

print(ans)
# Judge status: Accepted

X,Y=open(0).read().split()

X=int(X)

Y=int(Y)


for i in range(110000):
    if (2**i) >= 1000000000000000000:
        #print(i)
        break



list1=[2**i*X for i in range(61) if 2**i*X <= Y]

print(len(list1))
# Judge status: Accepted
N = int(input())
ans = 0
for n in range(1,N+1):
    if len(str(n)) % 2 == 1:
        ans += 1
print(ans)
# Judge status: Accepted
s=list(map(str, input()))
s_=s.copy()
s.reverse()
a=s_[:int((len(s_)-1)/2)]
a_=a.copy()
a.reverse()
b=s_[int((len(s_)+3)/2)-1:]
b_=b.copy()
b.reverse()
if s_==s and a_==a and b_==b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
K, S = map(int, input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if 0 <= z <= K:
            ans += 1

print(ans)
# Judge status: Accepted
n, x, t = map(int, input().split())
a = n // x
if n % x != 0:
    a += 1
print(a * t)
# Judge status: Accepted
n, t = [int(i) for i in input().split()]
list_route = [list(map(int, input().split())) for list_route in range(n)]
ans = 1001
for i in range(0, n):
    if list_route[i][1] <= t and ans >= list_route[i][0]:
        ans = list_route[i][0]
if ans != 1001: print(ans)
else: print("TLE")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

dp = [0] * (N+1)
dp[0] = 1000
for i in range(1, N+1):
    dp[i] = dp[i-1]
    for j in range(1,i):
        dp[i] = max(dp[i], dp[j] // A[j-1] * A[i-1] + (dp[j] % A[j-1]))

print(dp[-1])
# Judge status: Wrong Answer
import collections
N = int(input())
A = list(map(int,input().split()))

#index,h
pp =[]
pm = []
all_set = set()
for i in range(N):

    pp.append(i + A[i])
    pm.append( i - A[i])

count = 0
c = collections.Counter(pp)
#print(c)
for i in range(N):
    count += c[pm[i]] 
    print(c[pm[i]])

    #count += pp.count(pm[i])
    #count += pm.count(pp[i])

print(count)
# Judge status: Wrong Answer
n, m, X, Y = map(int, input().split())

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

max_x = max(x)
min_y = min(y)

if Y-X >=1 and min_y - max_x >= 1 and max_x - Y >= 1 and min_y - X >= 1:
    print('No War')
else:
    print('War')
# Judge status: Wrong Answer
import sys
from functools import reduce
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
def gcd_list(numbers):
    return reduce(gcd, numbers)

n = int(input())
a = list(map(int, sys.stdin.readline().split()))
c = [gcd_list(a[:i] + a[i+1:]) for i in range(n)]
c.sort()
if n == 2:
    print(c[1])
else:
    print(c[2])
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

def comb(x):
    if x > 1:
        return int(x*(x-1)/2)
    return 0

M = [0 for _ in range(N+1)]
C = [0 for _ in range(N+1)]
_C = [0 for _ in range(N+1)]

for i in range(N):
    M[A[i]] += 1
for i in range(N):
    cnt = M[A[i]]
    C[A[i]] = comb(cnt)
    _C[A[i]] = comb(cnt-1)

S = sum(C)
for i in range(N):
    print(S - C[A[i]] + _C[A[i]])
# Judge status: Accepted
N,M = list(map(int,input().split()))
if N == M:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
eneNum, spNum = map(int, input().split())
eneHp = map(int, input().split())
eneHpList = list(eneHp)

# TLE
#count = 0
#for i in range(spNum):
#    if len(eneHpList) > 0:
#        maxEneHp = max(eneHpList)
#        eneHpList.remove(maxEneHp)

# new method
eneHpList.reverse()
del eneHpList[0:spNum]
count = sum(eneHpList)

print("{}".format(count))