peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
num_sub  = int(input())
sub_boss = input().split()

num_boss = [0]*(num_sub)

for i in sub_boss:
	i = int(i)
	num_boss[i-1] = num_boss[i-1] + 1

for i in num_boss:
  print(i)
# Judge status: Wrong Answer
a = int(input())
b = int(1)

for i in range(114514):
  a = a // 2
  b = b + 1
  if a == 1:
    break
  else:
    pass

print(2 ** b - 1)
# Judge status: Wrong Answer
n = int(input())
t = [int(input()) for _ in range(n)]
ans = t[0]

for v in t:
    if ans < v:
        if v % ans != 0:
            ans *= v
        else:
            ans = v

print(ans)
# Judge status: Accepted
a,b = map(int, input().split())
poker = [2,3,4,5,6,7,8,9,10,11,12,13,1]
if poker.index(a) == poker.index(b):
    print("Draw")
elif poker.index(a) > poker.index(b):
    print("Alice")
else:
    print("Bob")
# Judge status: Accepted
import math

def main():
    A, B, C, D = map(int, input().split())
    lcm = C * D // math.gcd(C, D)
    C_div = B // C - (A - 1) // C
    D_div = B // D - (A - 1) // D
    C_D_div = B // lcm - (A - 1) //lcm
    print(B - A + 1 - C_div - D_div + C_D_div)


if __name__ == '__main__':
    main()
# Judge status: Accepted
from operator import itemgetter
n = int(input())
s = []
p = []
b = []
cnt = 1
while True:
  try:
    ts,tp = map(str,input().split())
    s.append(ts)
    p.append(int(tp))
    b.append((ts,int(tp),cnt))
    cnt +=1
  except:
    break

data = sorted(b, key=itemgetter(1), reverse=True)
data = sorted(data, key=itemgetter(0), reverse=False)

for i in data:
  print(i[2])
# Judge status: Accepted
n,m = map(int, input().split())
x = n-sum(list(map(int, input().split())))

if x < 0: 
    print(-1)
else:
    print(x)
# Judge status: Accepted
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    w,h,x,y = LI()
    area = w * h
    ans1 = area /2
    ans2 = 0
    if w == 2*x and h == 2*y:
        ans2 = 1

    print(ans1,ans2)

main()
# Judge status: Wrong Answer
x, y, z = map(int,input().split())
print(max(int(y//x), z))
# Judge status: Accepted
N, K = map(int, input().split())
points = {c: p for c, p in zip("spr", map(int, input().split()))}
strings = [[] for _ in range(K)]
counts = [1] * K
ans = 0
for i, c in enumerate(list(input()) + [""] * K):
    idx = i % K
    if strings[idx]:
        last = strings[idx][-1]
        if c == last:
            counts[idx] += 1
        else:
            ans += ((counts[idx] + 1) >> 1) * points[last]
            counts[idx] = 1
    strings[idx].append(c)
print(ans)
# Judge status: Accepted
import bisect
n = int(input())
colors = [-1]*(n+1)
for _ in range(n):
    a = int(input())
    idx = bisect.bisect_left(colors, a)-1
    colors[idx] = a
print(n-bisect.bisect_left(colors, 0)+1)
# Judge status: Accepted
def main():
    N, a, b, c, d = (int(i) for i in input().split())
    S = input()
    if "##" in S[a:c] or "##" in S[b:d]:
        return print("No")
    if c < d:
        return print("Yes")
    # d < c
    if "..." in S[b-2:d+1]:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
x,a,b = map(int,input().split())
if abs(x - a) < abs(x - b):
  print('A')
else:
  print('B')
# Judge status: Accepted
#!/usr/bin/env python3

N = int(input())
A = sorted(list(map(int, input().split())))[::-1]

h = A[0]/2
r = 10**9
v = 0
for a in A[1:]:
    if r > abs(a-h):
        r = abs(a-h)
        v = a

print(str(A[0]) + ' ' + str(v))
# Judge status: Wrong Answer
def readints():
    return list(map(int, input().split()))


s = str(input())
t = ['a', 'b', 'c']
print(sorted(s))
# print(t)
sum = 0
for i in range(3):
    if s[i] == t[i]:
        sum += 1
if sum == 3:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S = input()
if S == "Sunny":
  print('Cloudy')
elif S == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')
# Judge status: Accepted
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
S = list(input().rstrip())

S.sort()
print("Yes" if S[0]==S[1] and S[2]==S[3] and S[0]!=S[-1] else "No")
# Judge status: Accepted
x, y = map(int, input().split())

max = 4*x
min = 2*x

if y % 2 == 0 and min <= y <= max:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a=list(map(int,input().split()))
k=int(input())
for i in range(k):
    a[a.index(max(a))]*=2
print(sum(a))
# Judge status: Accepted

def main():
  n = int(input())
  cnt = 0
  same = 0

  for a in range(1, n):
    for b in range(a, n):
      if a * b >= n:
        break

      cnt += 1
      if a == b:
        same += 1

  print((cnt - same) * 2 + same)



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


def f(x):
    return (a * x // b) - a * (x // b)

print(f(min(b - 1, n)))
# Judge status: Accepted
import math
n = int(input())
x = math.sqrt(n)
print (int(x)**2)
# Judge status: Wrong Answer
from collections import Counter
s = str(input())
s = Counter(s).most_common()
if len(s)%2 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n, h = map(int, input().split())

a = [0]* n
b = [0]* n
for i in range(n):
    a[i], b[i] = map(int, input().split())

amax = max(a)
ans = 0

b.sort(reverse=True)

for attack in b:

    if attack < amax: break
    h -= attack
    ans += 1
    if h <= 0:
        exit()

ans += -(-h//amax)

print(ans)
# Judge status: Wrong Answer
S = input()
cnt = 0
for i in range(len(S)-1):
    for j in range(1, len(S)):
        if S[i] == S[j]:
            cnt += 1

if cnt == 2:
    print("Yes")

else:
    print("No")
# Judge status: Accepted
n = int(input())
s = input()
l = [0]
ans = 10**6
for i,si in enumerate(s):
    l.append(l[i]+(si=="W"))
for i in range(n):
    ans = min(ans,l[i]+(n-1-i)-(l[-1]-l[i+1]))
    #print(i,f"W{l[i]} E{(n-1-i)-(l[-1]-l[i+1])}",s[:i],s[i+1:])
print(ans)
# Judge status: Accepted
S = input()
T = input()

ans = 0

if S == T:
    ans = 0
else:
    for i, j in zip(S, T):
        if i != j:
            ans += 1

print(ans)
# Judge status: Wrong Answer
from math import factorial, sqrt

def dist(x1, y1, x2, y2):
    return sqrt((x1 - x2)**2 + (y1 - y2)**2)


N = int(input())
x, y = [0]*N, [0]*N
for i in range(N):
    x[i], y[i] = map(int, input().split())

ans = 0
count = N * (N-1) / 2

for i in range(N-1):
    for j in range(i+1, N):
        ans += dist(x[i], y[i], x[j], y[j]) * count

ans = ans / factorial(N)

print(ans)
# Judge status: Accepted
def kalin(s):
  N=len(s)
  for i in range(N//2):
    if s[i]!=s[-1-i]:
      return False
  return True

def strong(s):
  N=len(s)
  tail = (N-1)//2
  s0=s[0:tail]
  head = (N+3)//2
  s1=s[head-1:]
  # print('s0={} s1={}'.format(s0,s1))
  return kalin(s0) and kalin(s1) and kalin(s)  

if strong(input()):
  print('Yes')
else:
  print('No')
# Judge status: Accepted

N, K = map(int, input().split())
X = [int(input()) for _ in range(N)]

X.sort()
res = 10 ** 9 + 7
for i in range(N - K + 1):
    res = min(res, X[i + K - 1] - X[i])
print(res)
# Judge status: Wrong Answer
import sys

S = {}
S["a"] = list(sys.stdin.readline().strip())
S["b"] = list(sys.stdin.readline().strip())
S["c"] = list(sys.stdin.readline().strip())

target = "a"
while True:
    next_target = S[target].pop()
    if len(S[target]) == 0:
        break
    target = next_target

print(target.upper())
# Judge status: Accepted
n = int(input())

t=[]
x=[]
y=[]

for i in range(n):
    a,b,c = map(int,input().split())
    t.append(a)
    x.append(b)
    y.append(c)


ans = True
move=(x[0]+y[0])
time = t[0] - 0
if move > time:ans = False
if (time - move)%2 ==1:ans = False

for i in range(1,n):
    move =x[i] + y[i] - x[i-1] - y[i-1]
    time =t[i] - t[i-1]
    if move > time:ans = False
    if (time - move)%2 ==1:ans = False

if ans:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b, c, x, y = map(int, input().split())

ans = 0

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

print(ans)
# Judge status: Wrong Answer
form = input()
form = form.split()

if form == [5,7,5]:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np

#  = input()
#  = int(input())
N, K = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

if N > K:
    seimin = N - (N//K) * K
    print(min(seimin, abs(seimin-K)))
else:
    print(N)
# Judge status: Wrong Answer
x, y = input().split()
if x <= y:
  print("unsafe")
else:
  print("safe")
# Judge status: Wrong Answer
s = input()
if (int(s[:2]) > 12)&(int(s[2:]) <= 12)&("00" not in s):
    print("YYMM")
    
elif (int(s[:2]) <= 12)&(int(s[2:]) > 12)&("00" not in s):
    print("MMYY")

elif (int(s[:2]) <= 12)&(int(s[2:]) <= 12)&("00" not in s):
    print("AMBIGUOUS")

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

if A % 2 != 0 and B % 2 != 0 and C % 2 != 0:
    tmp1 = A * B
    tmp2 = C // 2
    tmp3 = C - tmp2
    ans = tmp1 * tmp3 - tmp1 * tmp2
    print(ans)
else:
    print(0)
# Judge status: Accepted
ans = []
type = [[1]]
que = []
N = int(input())
for i in range(N-1):
    que = type
    type = []
    while len(que) != 0:
        t = que.pop()
        ma = max(t)
        for j in range(1,ma+2):
            type.append(t + [j])
type.sort()
char = " abcdefghijklmnopqrstuvwxyz"
for a in type:
    print("".join(map(lambda x: char[x], a)))
# Judge status: Wrong Answer
N = int(input())

count = 0

for a in range(N + 1):
  for b in range(N + 1):
    c = N - a * b
    
    if c >= 0:
      count += 1
    
print(count)
# Judge status: Accepted
N = int(input())
S = input()

if N % 2 == 0:
    n = N // 2
    if S[0:n] == S[n:N]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Wrong Answer
def main():
    N, M = map(int, input().split())
    search = M//N + 1
    for s in range(search, 0, -1):
        sum_array = s * N
        remain = M - sum_array
        if remain % s == 0:
            print(s)
            return

if __name__ == "__main__":
    main()
# Judge status: Accepted
N=int(input())
ans=0
for i in range(N+1):
    ans+=i
print(ans)
# Judge status: Accepted
n,l=map(int,input().split())
s=sorted(list(input() for i in range(n)))
ans=' '
for i in range(n):
  ans+=s[i]
print(ans)
# Judge status: Wrong Answer
from itertools import accumulate
N = int(input())
S = list(input())
kuro = [0]*N
shiro = [0]*N
ans = N

for i in range(N):
    if S[i] == "#":
        kuro[i] = 1
    else:
        shiro[i] = 1
shiro.reverse()
shiro = list(accumulate(shiro))
kuro = list(accumulate(kuro))

for i in range(N-1):
    ans = min(ans, kuro[i]+shiro[N-i-2])

ans = min(ans, kuro[N-1])

print(ans)
# Judge status: Accepted
N, K = [int(x) for x in input().split()]
A_lst = [int(x) for x in input().split()]
dict = {}
for i in A_lst:
    if not i in dict.keys():
        dict[i] = 1
    else:
        dict[i] += 1

lst = []
for i in dict.keys():
    lst.append(dict[i])
lst.sort()
k = len(lst)
cnt = 0

for i in lst:
    if k <= K:
        break
    else:
        k -= 1
        cnt += i

print(cnt)
# Judge status: Accepted
A,B,C=list(map(int,input().split()))
for i in range(1,B+1):
    if A*i%B==C:
        print("YES")
        exit()
print("NO")
# Judge status: Wrong Answer
li = list(input())
ans = ""
for i in range(len(li)):
  if li[i] == 0:
    ans = ans + "0"
  elif li[i] == 1:
    ans = ans + "1"
  elif li[i] == "B":
    ans = ans[:len(ans)-1]
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
if (a+b)%2==0:
    print((a+b)//2)
else:
    print('IMPOSSIBLE')
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
count = 0
count2 = 0
for i in range(N):
  if a[i]%4 == 0:
    count += 1
  elif a[i]%2 == 0:
    count2 += 1
if count2 == 0:
  if N//2 <= count + 1:
    print("Yes")
  else:
    print("NO")
else:
  if N-count2 <= count*2:
    print("Yes")
  else:
    print("NO")
# Judge status: Accepted
#!/usr/bin/env python3

from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline

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

if sum(a) > n:
    print('-1')
else:
    print(n - sum(a))
# Judge status: Wrong Answer
N,T=list(map(int,input().split()))
minCos = 10000
ans = 0
for i in range(N):
  c,t=list(map(int,input().split()))
  if t < T:
    if min(minCos,c) == c:
      ans = i+1
      minCos = c
if ans == 0:
  print("TLE")
else:
  print(ans)
# Judge status: Accepted
n = int(input())
nums = [int(x) for x in input().split()]
ops = 0
cont = 1
while cont:
	for x in range(n):
		if nums[x] % 2 == 0:
			nums[x] = nums[x]/2
		else:
			cont = 0
			break
	ops += cont
print(ops)
# Judge status: Accepted
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]

h.sort()

ans = 10**10

for i in range(N-K+1):
    ans = min((h[i+K-1] - h[i]), ans)
print(ans)
# Judge status: Accepted
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    c = 0
    t = i
    for j in range(5):
        c += t % 10
        t //= 10
    if a <= c and c <= b:
        ans += i
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
s, p, r = map(int, input().split())
t = input()
pre = "0"
ans = 0

for i in range(k):
    for j in t[i::k]:
        if j != pre:
            if j == "s":
                ans += s
            elif j == "p":
                ans += p
            elif j == "r":
                ans += r
            pre = j
        else:
            pre = "0"
    pre = "0"
    
print(ans)
# Judge status: Wrong Answer
def main():
    N = int(input())
    print(1000 - (N % 1000))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
# 整数の入力
A = int(input())
cnt = 0
for i in range(1, A):
  for j in range(1, A):
    x = str(i)
    y = str(j)

    first_x = x[0]
    last_x = x[-1]
    first_y = y[0]
    last_y = y[-1]
    
    if(first_x ==  last_y and last_x == first_y):
      cnt = cnt + 1
      continue
      
print(cnt)
# Judge status: Accepted
n=int(input())
a=[int(input()) for _ in range(n)]
ans=[-a[0]]
ansl=1
from bisect import bisect_right
for ai in a[1:]:
  tmp=bisect_right(ans,-ai)
  if tmp<ansl:
    ans[tmp]=-ai
  else:
    ans.append(-ai)
    ansl+=1
print(ansl)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
A.remove(min(A))
print(sum(A))
# Judge status: Accepted
n=input().split()
te = n[0]*int(n[1])
re = n[1]*int(n[0])
list=[te,re]
rest = sorted(list)
print(rest[0])
# Judge status: Wrong Answer
N,K=map(int,input().split())
A=list(map(int,input().split()))
#最終的にすべて同じ値になるなら、最小値のほうから攻めるべき
#早いソートにしたほうがいいかも。2部探索とか
mini_index=A.index(1)
if N<=K:
    print(1)
else:
    length=K
    count=1
    while(True):
        length+=K-1
        count+=1
        if length>N:
            print(count)
            break
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()
LR = [tuple(map(int, input().split())) for _ in range(Q)]

cum = [0]*(N+1)

cnt = 0
for i in range(1,N):
    if S[i-1] == 'A' and S[i] == 'C':
        cnt += 1
    cum[i] = cnt

ans = []
for l, r in LR:
    result = cum[r-1] - cum[l-1]
    ans.append(result)

print(*ans, sep='\n')
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      if (L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i] and L[i]+L[j]+L[k] > 2*max(L[i],L[j],L[k])):
        ans+=1
print(ans)
# Judge status: Accepted
a, b, x = map(int, input().split())

cnta = max((a - 1) // x + 1, 0)
cntb = b // x + 1

print(cntb - cnta)
# Judge status: Wrong Answer
# input
ABC = list(map(int, input().split()))

# check
ABC.sort()
X = 10 * ABC[0] + ABC[1]
Y = ABC[2]
print(X + Y)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(K):
  new = [0] * (N+1)
  for j in range(N):
    new[max(0, j-A[j])] += 1
    if j+A[j]+1 <= N-1:
      new[j+A[j]+1] -= 1
  A[0] = new[0]
  for j in range(1, N):
    new[j] += new[j-1]
    A[j] = new[j] 
  for ai in A:
    if ai != N:
      break
  else:
    break
    
print(' '.join([str(ai) for ai in A]))
# Judge status: Accepted
a,b,c = map(int,input().split())

if b-a == c-b:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

for i in range(n):
    if a[i] == 1:
        break

print((n+k-3)//(k-1))
# Judge status: Wrong Answer
def fx(n):
  cnt = 0

  for i in range(1,10000):
    if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break
    for j in range(1, 10000):
      if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break
      for k in range(1, 10000):
        formula = (i+j+k)**2 - i*j - j*k - k*i
        if formula == n:
          cnt+=1
        if formula >= n:
          break
  
  return cnt


n = int(input())
for i in range(1,n):
  print(fx(i))
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))

ans = 0
height = h[0]
count = 0
i = 1
while i < n:
	if h[i] <= height:
		count += 1
		height = h[i]
		i += 1
	else:
		ans = max(ans,count)
		count = 0
		height = h[i]
		i += 1
print(max(ans,count))
# Judge status: Wrong Answer
a,b=map(int,input().split())
s=str(input())
c=0-b
if s[:a-1].isdecimal()==True and s[c:].isdecimal()==True and s[a]=="-":
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
if __name__ == '__main__':
    n,m = map(int,input().split())
    A = list(map(int,input().split()))
    A.sort()

    B = []
    for i in range(m-1):
        #差分を求める
        B.append(A[i+1] - A[i])
    B.sort()
    
    print(sum(B[:m-n]))
# Judge status: Accepted
def main():
    A, B, T = map(int, input().split())

    ans = int(((T + 0.5) // A) * B)

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
c1 = input()
c2 = input()

print("Yes" if c1 == c2[::-1] else "No")
# Judge status: Accepted
N = int(input())

lst = [['a']]
for i in range(N - 1):
    n = len(lst)
    tmp_lst = []
    tmp_append = tmp_lst.append
    for j in range(n):
        tmp = lst[j]
        count = len(set(tmp))
        for k in range(count + 1):
            tmp_append(tmp + [chr(k + 97)])
    lst = tmp_lst
lst.sort()

for tmp in lst:
    print (*tmp, sep = '')
# Judge status: Accepted
a,b=input().split()
c=int(a+b)
for i in range(1,1000):
    if i*i==c:
        print("Yes")
        exit()
print("No")
# Judge status: Accepted
def nCr(n_, r_, m_):
  c = min(r_ , n_ - r_)
  bunshi = 1
  bunbo = 1
  for i in range(1,c+1):
    bunshi = bunshi * (n_+1-i) % m_
    bunbo = bunbo * i % m_
  return bunshi * pow(bunbo, m_-2, m_) % m_


x,y = map(int,input().split())
s = max(x,y)
t = min(x,y)
u = 2*t-s
if u%3 != 0 or u < 0:
  print(0)
else:
  a = u//3
  b = a + s - t
  ans = nCr(a+b,b,10**9+7)
  print(ans)
# Judge status: Wrong Answer
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    if t:
      xy.append(t)
    else :
      break
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N):
  a = xy[i]
  time = a[0]-time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    exit()
  elif (time-dis)%2 == 1:
    print("No")
    exit()
    
  else :
    loc = [a[1],a[2]]
    
  
else :
  print("Yes")
# Judge status: Accepted
from math import sqrt
from fractions import gcd

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

ans = 1

g = gcd(A, B)

for i in range(2, 1 + int(sqrt(g))):

    if g % i == 0:
        ans += 1

        while g % i == 0:
            g //= i

if g != 1:
    ans += 1

print(ans)
# Judge status: Accepted
S = input()
S1, S2 = S[:(len(S) - 1) // 2], S[(len(S) + 3) // 2 - 1:]
print("Yes" if S[::-1] == S and S1[::-1] == S1 and S2[::-1] == S2 else "No")
# Judge status: Accepted
import collections
mod = 998244353

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

if D[0] != 0 or 0 in D[1:]:
    print(0)
    exit()

Dep = collections.Counter(D)
values, counts = zip(*Dep.most_common())
#print(values)
#print(counts)
#print(Dep)
ans = 1
for i in range(1,len(values)):
    if Dep[i-1] == 0:
        ans = 0
    ans *= pow(Dep[i-1],Dep[i], mod)
    #print(i,Dep[i])
    ans %= mod
print(ans)
# Judge status: Accepted
x, a, b = map(int, input().split())

if b <= a:
    print('delicious')
elif a < b <= a + x:
    print('safe')
else:
    print('dangerous')
# Judge status: Accepted
import fractions

N,X = map(int, input().split())
S = list(map(int, input().split()))
S = [abs(s-X) for s in S]

gcd = S[0]
for k in range(N-1):
  gcd = fractions.gcd(gcd, S[k+1])
print(gcd)
# Judge status: Accepted
n = int(input())
b = list(map(int, input().strip("").split(" ")))

sum = 0

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

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

mini = min(arr)
maxi = max(arr)
cost = 10000

for i in range(mini, maxi+1):
    add = 0
    for j in range(n):
        add = add + (arr[j] - i)**2
    cost = min(cost, add)
print(cost)
# Judge status: Accepted
import sys
input = sys.stdin.readline


n, m = map(int, input().split())
a = [0] * m
dp = [0] * (n + 1)
mod = 10 ** 9 + 7
for i in range(m):
    a[i] = int(input())
a = set(a)
dp[:2] = 1, 1 if 1 not in a else 0

for i in range(2, n + 1):
    if i not in a:
        dp[i] = (dp[i - 1] + dp[i - 2]) % mod
print(dp[-1])
# Judge status: Wrong Answer
s = input()

N,W,S,E = s.count("N"),s.count("W"),s.count("S"),s.count("E")

if (N > 0 and S == 0) or (N == 0 and S > 0) or (S > 0 and W == 0) or (S == 0 and W > 0):
	print("No")
else:
	print("Yes")
# Judge status: Accepted
x1 = input().split(" ")
x2 = [int(i) for i in x1]


x3 = x2[0]*x2[1]

if x3 % 2 == 0:
    print("Even")
elif x3 % 2 == 1:
    print("Odd")
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
ans=[a*b,a*c,a*d,b*c,b*d,c*d,0]
print(max(ans))
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))

mid1, mid2 = sorted(X)[N//2-1:N//2+1]
print('\n'.join(str(mid1) if xi>mid1 else str(mid2) for xi in X))
# Judge status: Accepted
n = int(input())
print(((n % 2 == 0) and (n // 2)) or (n // 2 + 1))
# Judge status: Accepted
p=['a','b','c']
l=[list(input()) for _ in range(3)]
x=0
while True:
    if l[x]==[]:break
    x=p.index(l[x].pop(0))
print(p[x].upper())
# Judge status: Accepted
N = int(input())
p = list(map(int, input().split()))
check = 0
for i in range(N):
  if i+1 != p[i]:
    check += 1
print("YES" if check <= 2 else "NO")
# Judge status: Accepted
l = int(input())
print(l ** 3 / 27)
# Judge status: Accepted
# A - Dividing a String
def count_substrings(first_substring):

	arr = [first_substring]
	i = len(first_substring)

	while i < len(S):
		s = S[i]
	
		if s == arr[-1]:
			if i + 1 < len(S):
				i += 1
				s += S[i]
			else:
				arr[-1] += s
				break
	
		arr.append(s)
		i += 1

	return len(arr)


S = input()

ans1 = count_substrings(S[:1])
ans2 = count_substrings(S[:2])

print(max(ans1, ans2))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ans = 10**9
for i in range(-100, 101):
    cost = 0
    for j in a:
        cost += (j-i)**2
    ans = min(ans, cost)
print(ans)
# Judge status: Accepted
from collections import Counter

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

C = Counter(A)
C = [[k, v] for k, v in C.items() if v >= 2]
C.sort(key=lambda x:x[0], reverse=True)

ans = 0
if len(C) >= 1:
    if C[0][1] >= 4:
        ans = C[0][0] * C[0][0]
    elif len(C) >= 2:
        ans = C[0][0] * C[1][0]

print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
i = 1
for j in a:
    ans[j-1] = i
    i += 1
print(ans)