peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
table = { "r": p, "s": r, "p": s }

score = [0] * n
for i in range(n):
    if i-k < 0:
        score[i] = table[t[i]]
        continue
    if score[i-k] != table[t[i]]:
        score[i] = table[t[i]]

print(sum(score))
# Judge status: Accepted
def main():
    H = int(input())
    div = {2**i for i in range(40)}
    ans = 0
    from math import log2, ceil
    if not(H in div):
        for h in range(int(log2(H)) + 1):
            ans += 2**h
        print(ans)
    else:
        for h in range(int(log2(H)) + 1):
            ans += 2**h
        print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if U == S:
  A -= 1
else:
  B -= 1

print(A, B)
# Judge status: Wrong Answer
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

k = 1
p = False
for i in range(n):
    if a[k-1] == 2:
        print(i+1)
        p = True
    k = a[k-1]
if not p:
    print(-1)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()

print(N * (N+1) // 2)
# Judge status: Accepted
sdush = input()
t = input()

ans = []
for i in range(len(sdush)-len(t)+1):
  for index,c in enumerate(t):
    if c != sdush[i+index] and sdush[i+index] != '?':
      break
    if index+1 == len(t):
      ans.append(sdush[:i]+t+sdush[i+1+index:])

result = "z"*50
for an in ans:
  if result > an:
    result = an
if result == "z"*50:
  print("UNRESTORABLE")
else:
  print(result.replace("?","a"))
# Judge status: Accepted
for i in range(1):
   n=int(input())
   l=list(map(int,input().split()))
   c=0
   for i in range(n):
       if((i+1)%2!=0 and l[i]%2!=0):
           c=c+1
   print(c)
# Judge status: Accepted
A,B = map(int,input().split())
c = 1
t = int(max(A,B)**0.5)

for i in range(2,t+2):
    k = 0
    while(A % i == 0 and B % i == 0):
        k = 1
        A = A//i
        B = B//i
    c += k

for i in range(2,int(A**0.5)+2):
    while(A % i == 0):
        A = A//i

for i in range(2,int(B**0.5)+2):
    while(B % i == 0):
        B = B//i

if A == B and A > t:
    c += 1

print(c)
# Judge status: Accepted
N = int(input())
s = [input() for s in range(N)]
M = int(input())
t = [input() for t in range(M)]
ans = 0
for i in range(N):
	tmp = s.count(s[i]) - t.count(s[i])
	ans = max(ans,tmp)
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
sumA = sum(A)
minA = 10 ** 9 + 7
for x in range(N):
    slice_sumA = sum(A[:x])
    remainA = sumA - slice_sumA
    minA = min(minA, abs(slice_sumA - remainA))
print(minA)
# Judge status: Wrong Answer
n,k = map(int,input().split())
h = [int(i) for i in input().split()]
dp = [float('Inf') for i in range(n)]
dp[0]=0
for i in range(n):
    for j in range(1,k+1):
        if i-j<0:
            break
        
        dp[i]= min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
    print(dp)
print(dp[n-1])
# Judge status: Accepted
n, m, q = map(int, input().split())
L = []
for i in range(q):
    a,b,c,d = map(int, input().split())
    a -= 1
    b -= 1
    L.append((d, c, a, b))

import itertools
ans = -1
for p in itertools.combinations_with_replacement(range(1, m+1), n):
    #print(p)
    temp = 0
    for d, c, a, b in L:
        if p[b]-p[a] == c:
            temp += d
    ans = max(ans, temp)
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
if N * 2 <= M:
    print(N + (M - N * 2) // 4)
else:
    print(M // 2)
# Judge status: Accepted
def resolve():
    A, B, K = map(int, input().split())
    if 2*K > B-A+1:
        for _ in range(B-A+1):
            print(A+_)
    else:
        for i in range(K):
            print(A+i)
        for j in range(K):
            print(B-K+j+1)
resolve()
# Judge status: Accepted
N,K = map(int,input().split())
l = []
for i in range(N):
  l.append( list(map(int,input().split())) )
l.sort()
  
a = [0]
b = [0]
for i in range(N):
  [x,y] = l[i]
  a.append(x)
  b.append(y)

cnt = 0
for i in range(1,N+1):
  cnt += b[i]
  if cnt >= K:
    ans = a[i]
    break
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
 
count = {"R":0,"G":0,"B":0}
for c in s:
    count[c] += 1
 
r,g,b = count.values()
ans = r*g*b
for i in range(1,(n-1)//2+1): #1から
    for rgb in zip(s,s[i:],s[i*2:]):  #rgbに連続した三つのリストの要素を入れ込む
        if len(set(rgb)) == 3:  #リストrgbをセットにまとめ、長さが
            ans -=1
print(ans)
# Judge status: Accepted
def main():
    card_num = int(input())
    cards = list(map(int, input().split()))
    answer = float("inf")
    num_sum = [cards[0]] * card_num
    for i in range(1, card_num):
        num_sum[i] = num_sum[i - 1] + cards[i]
    for i in range(card_num - 1):
        answer = min(answer, abs(2 * num_sum[i] - num_sum[-1]))
    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Accepted
def solve(s):
    for size in range(len(s) // 2 - 1, 0, -1):
        if s[:size] == s[size:2 * size]:
            return 2 * size
    return 0

_s = input()
print(solve(_s))
# Judge status: Accepted
sx,sy,tx,ty = map(int,input().split())

ans = ''
ans += 'U'*(ty-sy)
ans += 'R'*(tx-sx)
ans += 'D'*(ty-sy)
ans += 'L'*(tx-sx)

ans += 'L'
ans += 'U'*(ty-sy+1)
ans += 'R'*(tx-sx+1)
ans += 'DR'
ans += 'D'*(ty-sy+1)
ans += 'L'*(tx-sx+1)
ans += 'U'
print(ans)
# Judge status: Accepted
S = input()

t1 = "dream"
t2 = "dreamer"
t3 = "erase"
t4 = "eraser"

while True:
    if S[-5:] == t1 or S[-5:] == t3:
        S = S[0:-5]
    elif S[-6:] == t4:
        S = S[0:-6]
    elif S[-7:] == t2:
        S = S[0:-7]
    elif len(S) == 0:
        print("YES")
        break
    else:
        print("NO")
        break
# Judge status: Wrong Answer
s=list()
s=input()
result=0
for i in range(4):
  if s[i]==s[i-1]:
    result=1

if result==0:
  print('Good')
else :
  print('Bad')
# Judge status: Wrong Answer
try:
  N, x = map(int, input().split())
  a = list(map(int, input().split()))
  a_ = sorted(a)
  cnt = 0
  for i in a_:
      if i<=x:
          cnt += 1
          x = x-i
      else:
          break
  print(cnt)
except EOFError:
  pass
# Judge status: Accepted
n=input()
a=n.count("7")
if a==0:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
ans=sum(B)
for s in range(N-1):
        if A[s+1]==A[s]+1:
            ans+=C[A[s]-1]
print(ans)
# Judge status: Accepted
N, K = list(map(int, input().split()))
treated = set()
for i in range(K):
    _ = input()
    
    treated = treated | (set(list(map(int, input().split()))))
print(len([x for x in range(N) if not x+1 in treated]))
# Judge status: Accepted
from sys import stdin
input = stdin.readline

D, N = map(int, input().split())

ans = 100 ** D * N

if N == 100:
    ans += 100 ** D

print(ans)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
print("Yes" if abs(c-a)<=d or abs(b-a)<=d and abs(c-b)<=d else "No")
# Judge status: Accepted
N, A, B = map(int, input().split())
S = input()
a = 0
b = 0
for s in S:
    if s == "c":
        print("No")
    elif s == "a":
        if a < A + B:
            print("Yes")
            a += 1
        else:
            print("No")
    else:
        b += 1
        if a < A + B and b <= B:
            a += 1
            print("Yes")
        else:
            print("No")
# Judge status: Accepted
# coding: utf-8
# Your code here!
n=int(input())
cnt=n//11
cnt*=2
if 0<n%11<=6:
    cnt+=1
elif n%11>6:
    cnt+=2
print(cnt)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = {}
ans = 0
for i in range(n):
    ans = max(ans, sum(a[0:i+1]) + sum(b[i:]) )
#    print("i=",i)
#    print( "sum(a[0:i+1])",sum(a[0:i+1]) )
#    print( "sum(b[i:])",sum(b[i:]) )
#    print()
print(ans)
# Judge status: Accepted
import sys

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))
S = [0] * (N + 1)
s = sum(A)

for i in range(N):
    S[i + 1] += S[i] + A[i]

mini = 10 ** 18
for i in range(1, N + 1):
    mini = min(mini, abs(S[N] - 2 * S[i]))

print(mini)
# Judge status: Accepted
r=int(input())
import math 
print(2*math.pi*r)
# Judge status: Accepted
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] = -A[i]
heapq.heapify(A)
for i in range(M):
    minv = - heapq.heappop(A)
    heapq.heappush(A, (minv//2)*(-1))
print(-sum(A))
# Judge status: Accepted
N = str(input())
ans = 0
for i in range(1, int(N)+1):
  if len(str(i)) % 2 == 1:
    ans += 1
print(ans)
# Judge status: Wrong Answer
import math
a=int(input())
s=list(map(int,input().split()))
p=sum(s)/a
psum=0
for i in s:
    psum+=(i-p)**2
print(math.ceil(psum))
# Judge status: Accepted
# D - Preparing Boxes

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

ans = [0] * N
for i in reversed(range(1, N + 1)):
    x = 0
    for j in range(i, N + 1, i):
        x += ans[j - 1]
    if x % 2 != A[i - 1]:
        ans[i - 1] = 1

print(ans.count(1))
print(*[i for i in range(1, N + 1) if ans[i - 1] == 1])
# Judge status: Wrong Answer
import itertools

S = list(input())
T = tuple(input())
flag = True
for s in itertools.permutations(S):
    if s == T:
        print('Yes')
        flag = False
        break
if flag:
    print('No')
# Judge status: Accepted
def main():
    num = int(input())
    l = list('abcdefghijklmnopqrstuvwxyz')
    name = []
    ans = ''

    while num > 0:
        num = num - 1
        name.append(l[num%26])
        num = num // 26

    name.reverse()

    for i in name:
        ans = ans + i
    print(ans)


main()
# Judge status: Accepted
x=[1,3,5,7,8,10,12]
y=[4,6,9,11]
a,b=map(int,input().split())
if a==2 or b==2:
    print('No')
elif a in x and b in x:
    print('Yes')
elif a in y and b in y:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# -*- coding: utf-8 -*-

S = list(str(input()))

chr_ord = 97

for i in range(26):
    if chr(chr_ord + i) not in S:
        print(chr(chr_ord + i))
        exit()

print('None')
# Judge status: Accepted
n,a,b=map(int,input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans+=min(a,rem)
print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
s=a+b

if s%3==0:
    print("Possible")
else:
    print("Impossible")
# Judge status: Wrong Answer
a, b = map(int, input().split())

if a<=9 and b<9:
	print(a*b)
else:
	print(-1)
# Judge status: Accepted
N=int(input())
String=input().replace("W","1").replace("R","2")
c=[0]*N
for i in range (N):
    c[i]=int(String[i])
s=sorted(c)
import bisect
a=bisect.bisect_right(s,1)
cnt=0
for j in range(N-a):
    if c[j]==1:
        cnt+=1
print(cnt)
# Judge status: Accepted
A, B = map(int,input().split())
puragu = 1
if B == 1:
  print(0)
  exit()
if A >= B:
  print(1)
  exit()

result = 0

while puragu < B:
  puragu += A-1
  result += 1

print(result)
# Judge status: Accepted
N=int(input())
AB=[list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x:(x[1], x[0]))
s=0
ans="Yes"
for A, B in AB:
    s+=A
    if s>B:
        ans="No"
        break
print(ans)
# Judge status: Accepted
n,A,B=map(int,input().split())
s=list(input())
cnt=0
cnt_b=0
for i in range(n):
	if s[i]=='a' and cnt<A+B:
		print('Yes')
		cnt+=1
	elif s[i]=='b' and cnt<A+B and cnt_b<B:
		print('Yes')
		cnt_b+=1
		cnt+=1
	else:
		print('No')
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
k = int(input())
note = max(a,b,c)
for i in range(k):
	note *= 2
print(note)
# Judge status: Accepted
n,m = map(int,input().split())
l = [0]*n
for i in range(m):
  a,b = map(int,input().split())
  l[a-1] += 1
  l[b-1] += 1
for i in l:
  print(i)
# Judge status: Accepted
S = str(input())
print(S[0:3])
# Judge status: Accepted


def main():
    a, b, c, d = map(int, input().split())
    while a >= 0 and c >= 0:
        c -= b
        if c <= 0:
            print("Yes")
            exit()
        a -= d
        if a <= 0:
            print("No")
            exit()


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

from collections import deque

N, K = map(int, input().split())
X = list(map(int, input().split()))

q = deque(X[:K])
for i in range(K, N):
    u = q.popleft()
    if u < X[i]:
        print("Yes")
    else:
        print("No")
    q.append(X[i])
# Judge status: Accepted
N=int(input())
S=[input() for _ in range(N)]

#print(S[1][0])
uniqued=set(S)
print(len(uniqued))
# Judge status: Wrong Answer
n,x,t=map(int,input().split())
if(n<=x):
    print(t)    
else:
    if(x<t):
        print((n*t)//x)
    else:
        while(n>x):
            x*=2
            t*=2
        print(t)
# Judge status: Accepted
A, B, C, X, Y = map(int, input().split())
ans = 0
if 2 * C < A + B:
    ans += min(X, Y) * 2 * C
    if X >= Y:
        ans += (X - Y) * min(A, 2 * C)
    else:
        ans += (Y - X) * min(B, 2 * C)
else:
    ans = X * A + Y * B
print(ans)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
ai = max(a)
aj = -1
dj = ai
for ak in a:
    if ak == ai:
        continue
    dk = abs(ai // 2 - ak)
    if dk < dj:
        aj = ak
        dj = dk
print(ai, aj)
# Judge status: Accepted
n = int(input())
d = list(map(int,input().split()))


d = sorted(d)
count = 0
if len(d)%2 == 0:
	if d[len(d)//2-1] == d[len(d)//2]:
		print(0)
	else:
		temp = d[len(d)//2]- d[len(d)//2-1]
		count += temp
		print(count)
else:
	print(0)
# Judge status: Accepted
A,B=map(int,input().split())
check=[1,2,3,4,5,6,7,8,9]
if A in check and B in check:
    print(A*B)
else:
    print("-1")
# Judge status: Wrong Answer
n = int(input())
x = list(map(int, input().split()))
s = sum(x)
p = (s+n-1)//n
r = 0
for y in x:
    r += (y - p)**2
print(r)
# Judge status: Accepted
A, B = map(int, input().split())
if (A % 3 == 0) or (B % 3 == 0) or ((A + B) % 3 == 0):
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
# input
N = int(input())
v = list(map(int, input().split()))
append = v.append

# check
for n in range(N - 1):
    v.sort()
    mix = (v[0] + v[1]) / 2
    append(mix)
    del v[0:2]

print(v[0])
# Judge status: Accepted
string=input()
n=[]
for letter in string:
    n.append(letter)
if ('N' in n and 'S' not in n) or ('S' in n and 'N' not in n) or ('E' in n and 'W' not in n)or ('W' in n and 'E' not in n):
    print('No')
else:
    print('Yes')
# Judge status: Accepted
import math

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

d=[]
i=1
while math.sqrt(M)>=i:
    if M%i==0:
        d.append(i)
        if i**2!=M:
            d.append(M//i)
    i=i+1
d.sort()#Mの約数列

m=0
i=0
while  len(d)-1>=i and M//N>=d[i]:
    if  M%d[i]==0:
        m=d[i]
    i=i+1
print(m)
# Judge status: Wrong Answer
n = int(input())
b = [0] + list(map(int,input().split()))
b[0] = b[1]
for i in range(1,len(b)):
    if b[-(i+1)]>b[-i]:
        b[-(i+1)]=b[-i]
print(sum(b))
# Judge status: Wrong Answer
a,b=map(int,input().split())
print((a+b)/24)
# Judge status: Wrong Answer
X = int(input())

maxi = 0

if X < 4:
    print(1)
    exit()

for i in range(1, X):
    for j in range(2, X):
        if i**j <= X and i**j >= maxi:
            maxi = i**j
        else:
            break

print(maxi)
# Judge status: Accepted
n=int(input())
n=n%10
if n==3:
    print('bon')
    exit()
l=[0,1,6,8]
if n in l:
    print('pon')
else:
    print('hon')
# Judge status: Wrong Answer
import math

N,K=map(int,input().split())
A=list(map(int, input().split()))
l=0
r=max(A)
while not l+1==r:
    x=math.ceil((r+l)/2)
    k=0
    for a in A:
        k+=a//x
    if k<=K:
        r=x
    else:
        l=x
print(r)
# Judge status: Wrong Answer
n,a,b,c,d = [int(x) for x in input().split()]
s = list(input())


if c < d:
    ans = "Yes"
    for i in range(1,n):
        if s[i-1] == s[i] == "#":
            ans = "No"
            break
else:
    ans = "No"
    for i in range(2,n):
        if s[i-2] == s[i-1] == s[i] == ".":
            ans = "Yes"
            break
print(ans)
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
ans=[None for i in range(n)]
for i in range(n):
    ans[A[i]-1]=str(i+1)
print(" ".join(ans))
# Judge status: Wrong Answer
sx, sy, tx, ty = map(int, input().split())
route =""
dx ,dy = tx-sy, ty-sy
path1 = "R"*dx+ "U"*dy
path2 = "L"*dx+ "D"*dy
dx, dy = dx + 1, dy + 1
path3 = "D"+"R"*dx+ "U"*dy + "L"
path4 = "U" + "L"*dx + "D"*dy + "R"
print(path1+path2+path3+path4)
# Judge status: Accepted
import sys


def main():
    h = int(input().replace('\n','').split()[0])
    tmp = input().replace('\n','').split()
    a=0
    for i in tmp:
        a+=int(i)
    if a >= h:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    input = sys.stdin.readline
    main()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

sum = 0
for i in range(n):
    if a[i] >= b[i]:
        sum += b[i]
    elif a[i+1] < b[i] - a[i]:
        sum += a[i] + a[i+1]
    else:
        sum += b[i]
        a[i+1] -= b[i] - a[i]

print(sum)
# Judge status: Accepted
from fractions import gcd

a, b, c, d = map(int, input().split())
lcm = c * d // gcd(c, d)
x = b - (b // c) - (b // d) + (b // lcm)
y = (a - 1) - ((a - 1) // c) - ((a - 1) // d) + ((a - 1) // lcm)
print(x - y)
# Judge status: Accepted
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	L = int(input())
	ans = (L / 3) ** 3
	print(ans)


if __name__ == '__main__':
	main()
# Judge status: Accepted
X = int(input())
ans = 100
count = 1

while(True):
    a = ans*0.01
    ans = ans + a
    ans = int(ans)
    #print(ans)

    if (X<=ans):
        print(count)
        break

    count += 1
# Judge status: Accepted
N, M = map(int, input().split())
*A, = map(int, input().split())
rem = N - sum(A)
print(rem if rem >= 0 else -1)
# Judge status: Accepted
N, M = map(int, input().split())

# Mの約数を列挙
sup = int(M**0.5) + 1
divs_left = []
divs_right = []
for i in range(1, sup+1):
  if M%i == 0:
    divs_left.append(i)
    divs_right.append(M//i)

divs = divs_right + divs_left[::-1]
for d in divs:
  if M//d >= N:
    print(d)
    quit()
# Judge status: Wrong Answer
H,W = map(int, input().split())
 
if H%2==0:
	print(int((H*W)//2))
 
else:
	print(int(((H+1)*W)//2-(W-1)//2))
# Judge status: Accepted
n = list(map(int, list(input())))
 
if n[0] == 1 and sum(n)  == 1:
    print(10)
else:
    print(sum(n))
# Judge status: Wrong Answer
input_angle = int(input())
input_length = input()

_length = input_length.split(' ')
length = [int(l) for l in _length]
length.sort()
sum = 0

for i in range(input_angle-2):
  sum += int(length[i])
  
if int(length[-1]) < sum:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n = int(input())
if n == 1 or n == 2:
  print(n * (n-1))
else:
  print((10 * n * (n - 1) - (4 * n)) % (10 ** 9 + 7))
# Judge status: Accepted
W,a,b=map(int,input().split())

if a<=b and a+W >= b:
    print(0)

elif a<b:
    print(b-(a+W))

elif a>=b and b+W >= a:
    print(0)
    exit()

elif a>b:
    print(a-(b+W))
# Judge status: Accepted
from decimal import Decimal

a,b = map(str,input().split())
a = Decimal(a)
b = Decimal(b)
ans = (a*b)
print(int(ans))
# Judge status: Accepted
A,B,C=list(map(int,input().split()))
K=int(input())
m=max([A,B,C])
print(sum([A,B,C])-m+m*2**K)
# Judge status: Accepted
N,K = map(int,input().split())
S = input()
ans = S[:K-1] + S[K-1].lower() + S[K:]
print(ans)
# Judge status: Wrong Answer
a,b,c = map(int, input().split())
if (a+b+c)>22:
    print('bust')
else:
    print('win')
# Judge status: Accepted
S="012 345 678 036 147 258 048 246 "
A=[input().split()for i in range(3)]
B=A[0]+A[1]+A[2]
for b in [input()for i in range(int(input()))]:
  if b in B:
    S=S.replace(str(B.index(b)),"")
print(["No","Yes"][S.find("  ")>-1])
# Judge status: Wrong Answer
P,Q,R = map(int,input().split())

print(P+Q+R-min(P,Q,R))
# Judge status: Wrong Answer
sx,sy,tx,ty = map(int,input().split())
going1 = ""
returning1 = ""
going2 = ""
returning2 = ""
going1 = 'R' * (tx - sx) + 'U' * (ty - sy)
returning1 = 'L' * (tx -sy) + 'U' * (ty - sy)
going2 = 'D' + 'R' * (tx - sx + 1) + 'U' * (ty - sy + 1) + 'L'
returning2 = 'U' + 'L' * (tx - sx + 1) + 'D' * (ty - sy + 1) + 'R' 
print(going1 + returning1 + going2 + returning2)
# Judge status: Accepted
n= int(input())
task = [list(map(int,input().split()))for i in range(n)]

task.sort(key= lambda x: x[1])
time = 0
for i in range(n):
    time += task[i][0]
    if time > task[i][1]:
        print("No")
        break
else:
    print("Yes")
# Judge status: Wrong Answer
# https://atcoder.jp/contests/abc112/tasks/abc112_d

n, m = map(int, input().split())
ans = 1
i = 1
limit = m ** 0.5
while i <= limit:
    if m % i == 0 and m // i >= n:
        ans = max(ans, i)
    i += 1
print(ans)
# Judge status: Wrong Answer
import sys, re
#input = sys.stdin.readline

S = input()

if S == 'keyence' or re.fullmatch(r'[a-z]+keyence', S) or re.match(r'k[a-z]+eyence', S) or re.match(r'ke[a-z]+yence', S) or re.match(r'key[a-z]+ence', S) or re.match(r'keye[a-z]+nce', S) or re.match(r'keyen[a-z]+ce', S) or re.match(r'keyenc[a-z]+e', S) or re.fullmatch(r'keyence[a-z]+', S):
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
#import random
n=int(input())

pnt=[]
for i in range(n):
  pnt.append(list(map(int,input().split())))
  #pnt.append([random.randint(int(-1e9),int(1e9)),random.randint(int(-1e9),int(1e9))])
pnt.sort(key=lambda x:abs(x[0])+abs(x[1]),reverse=True)
mn=list(reversed(pnt))
mx=0

for i in range(min(n,6000)):
  for j in range(i+1,min(n,6000)):
    mx=max(abs(pnt[i][0]-pnt[j][0])+abs(pnt[i][1]-pnt[j][1]),mx)
    mx=max(abs(pnt[i][0]-mn[j][0])+abs(pnt[i][1]-mn[j][1]),mx)
print(mx)
# Judge status: Accepted
from collections import deque 
n = int(input())

a = list(input().split())
b = []

q = deque()

for i in range(n):
    x = a[i]
    if n%2 == i%2:
        q.append(x)
    else:
        q.appendleft(x)

    
print(" ".join(q))
# Judge status: Accepted

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

list_num=range(L,R+1)
ans=0
for i in list_num:
    if i%d==0:
        ans+=1
print(ans)
# Judge status: Accepted
K, N = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
d = 0
for i in range(N):
    tmp = abs(A[i] - A[i-1])
    if tmp > K / 2:
        tmp = K - tmp
    if tmp > d:
        d = tmp
print(K - d)
# Judge status: Accepted
N = int(input())
p = 800*N
b = N//15 * 200
print(p-b)
# Judge status: Wrong Answer
N,M = map(int,input().split())
LR = [list(map(int,input().split())) for i in range(M)]

maxi = 0
mini = 10**6
for lr in LR:
    maxi = max(lr[0],maxi)
    mini = min(lr[1],mini)

if mini-maxi+1 >= N:
    print(N)
else:
    print(mini-maxi+1)
# Judge status: Wrong Answer
n = int(input())
data = []
for i in range(n):
    x, l = map(int, input().split())
    data.append([x, l])
data = sorted(data, key = lambda x: x[0])
ans = 1
pre = data[0][0] + data[0][1]
for i in range(1, n):
    if data[i][0] - data[i][1] >= pre:
        ans += 1
        pre = data[i][0] + data[i][1]

print(ans)
# Judge status: Accepted
from bisect import *


def inpl():
    return list(map(int, input().split()))


N = int(input())
A = inpl()
B = inpl()
C = inpl()
A.sort()
C.sort()

print(sum(bisect_left(A, b) * (N - bisect_right(C, b)) for b in B))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
d = {}
for x in a:
    d[x] = d.get(x, 0) + 1
d = sorted(d.items(), key=lambda x: x[0], reverse=True)

l = []
ans = 0
for num, cnt in d:
    if cnt > 1:
        l.append(num)
        if len(l) == 2:
            ans = l[0] * l[1]
            print(ans)
            exit()
    if cnt > 3:
        ans = num ** 2
        print(ans)
        exit()

print(ans)