peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
from math import gcd
k = int(input())
a = 0
for i in range(1,k+1):
  for j in range(1,k+1):
    s = gcd(i,j)
    for l in range(1,k+1):
      m = gcd(s,k)
      a = a + m
print(a)
# Judge status: Accepted
N = int(input())

W = 0

for i in range(1, N+1):
    W += i
    if W >= N:
        for j in range(1, i+1):
            if j != (W - N):
                print(j)
        break
# Judge status: Accepted
if int(input())%9:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
K, S = map(int, input().split())
ans = 0
for X in range(K+1):
    for Y in range(K+1):
        if 0 <= S-X-Y <= K:
            ans += 1
print(ans)
# Judge status: Accepted
s = input()
if '9' in s:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
nums = [int(i) for i in input().split()]
ans = 0
while True:
    if [i for i in nums if i % 2 == 1]:
        break
    nums = [i//2 for i in nums]
    ans += 1
print(ans)
# Judge status: Wrong Answer
a, b, k = (int(i) for i in input().split())
list_ComDiv = []
for i in range(1, max(a, b) + 1):
    if a % i == 0 and b % i == 0:
        list_ComDiv.append(i)
print(list_ComDiv[k - 1])
# Judge status: Wrong Answer
init = input()

words = [
  'dream',
  'dreamer',
  'erase',
  'eraser'
]

def reverseWord(str):
  return str[::-1]

def elimTheWord(str):
  for word in reversed_words:
    if str.find(word) == 0:
      str = str[len(word):]
  return str

reversed_words = list(map(reverseWord, words))

# main
target = reverseWord(init)

while True:
  pivot = elimTheWord(target)
  if pivot == '':
    print('Yes')
    break
  if pivot == target:
    print('No')
    break
  target = pivot
# Judge status: Wrong Answer
n, a, b = map(int, input().split())

x = a//2 + 1 if a%2 == 0 else (a+1)//2
y = b//2 + 1 if b%2 == 0 else (b+1)//2

print(2 if x == y else y-x)
# Judge status: Wrong Answer
N,M = map(int,input().split())
L,R = map(int,input().split())
pass_card = R - L + 1
for _ in range(M-1):
  L_now,R_now = map(int,input().split())
  if L_now > L:
    pass_card -= (L_now - L)
    L = L_now
  if R_now < R:
    pass_card -= (R - R_now)
    R = R_now
print(pass_card)
# Judge status: Accepted
A=int(input()) 
B=int(input()) 
C=int(input())
X=int(input())
cnt=0
for i in range(0,A+1):
    for j in range(0,B+1):
        for k in range(0, C+1):
            if 500*i+100*j+50*k==X:
                cnt+=1
            else:
                continue
print(cnt)
# Judge status: Wrong Answer
n,k = map(int, input().split())
num = []
for i in range(n):
    a,b = map(int, input().split())
    for i in range(b):
        num.append(a)
print(num[k-1])
# Judge status: Wrong Answer
n, m = map(int, input().split())
MOD = 10**9+7
ans = 1
if abs(n-m) > 1:
    print(0)
    exit()
elif abs(n-m) == 0:
    for i in range(1, n+1):
        ans = ans * i % MOD
    else:
        ans = ans ** 2 * 2 % MOD
else:
    cnt_n = 1
    cnt_m = 1
    for i in range(1, n+1):
        cnt_n = cnt_n * i % MOD
    for i in range(1, m+1):
        cnt_m = cnt_m * i % MOD
    else:
        ans = cnt_n * cnt_m
print(ans)
# Judge status: Wrong Answer
N = int(input())
S = ""
while N != 0:
    if N % 2 != 0:
        N -= 1
        S = "0" + S
    else:
        S = "1" + S
    N //= (-2)
print(S if S != "" else "0")
# Judge status: Accepted
A, B, N = map(int, input().split(" "))
if N < B :
    print ( int(A*N/B) )
else : 
    print ( int(A*(B-1)/B) )
# Judge status: Accepted
import math
n = int(input())
x = math.ceil(n / 1.08)
print(':(' if int(x * 1.08) != n else x)
# Judge status: Accepted
import math

r=int(input())

print(r*2*math.pi)
# Judge status: Accepted
s = input()
s1 = s[0]
s2 = s[1]
s3 = s[2]

if s1 == s2:
  if s1 == s3:
    print('No')
    exit()
print('Yes')
# Judge status: Wrong Answer
n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
mod = 1000000007

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

ans = dp[n] % mod
print(ans)
# Judge status: Accepted
n = int(input())
L = list(map(int,input().split()))
L1 = len([x for x in L if x < 0])
L.sort()
for i in range(n):
  if L[i] < 0:
    L[i] = -L[i]
#print(L)
if L1%2 == 0:
  print(sum(L))
else:
  print(sum(L)-2*min(L))
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
ans = 0
cnt = 1
for i in range(n):
    if a[i] == cnt:
        cnt += 1
    else:
        ans += 1
if ans == n:
    print(-1)
else:
    print(ans)
# Judge status: Wrong Answer
N = int(input())

def perfect_number(x, y, z):
  n = x**2 + y**2 + z**2 + x*y + y*z + z*x
  return n
l = []
for x in range(1, N):
  for y in range(1, N):
    for z in range(1, N):
      n = perfect_number(x,y,z)
      if n > N:
      	break
      else:
        l.append(n)


counts = [l.count(x) for x in sorted(set(l))]
d = dict(zip(l, counts))
for i in range(1, N+1):
  if i in d:
  	print(d[i])
  else:
    print(0)
# Judge status: Accepted
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

A, B, C = map(int, readline().split())

if (A % 2 == 0) or (B % 2 == 0) or (C % 2 == 0):
    print(0)
else:
    tmp = [A, B, C]
    tmp = sorted(tmp)
    print(tmp[0] * tmp[1])
# Judge status: Wrong Answer
n = int(input())
ab = [0]*n
ans = 0
for i in range(n):
    a,b = map(int,input().split())
    ans += (b-(a+ans))%b
print(ans)
# Judge status: Wrong Answer
wet = ["Sunny","Cloudy","Rainy"]
s = wet.index(input())
print(wet[s+1] if s != 2 else wet[1])
# Judge status: Accepted
s = list(input())
abc = list('abcdefghijklmnopqrstuvwxyz')
abc_exist = [False] * 26

for i in range(len(s)):
  for j in range(26):
    if s[i] == abc[j]:
      abc_exist[j] = True

r = 'None'      
for k in range(26):
  if abc_exist[k] == False:
    r = abc[k]
    break
    

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

N2 =str(N)[0]+(len(str(N))-1)*"9"
ans = 0
for n in N2:
    ans+=int(n)
if int(N2) > N:
    ans-=1
print(ans)
# Judge status: Accepted
x,y,z = map(int,input().split())

print((x - z) // (y + z))
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
A.sort()

cnt = [0] * (10**6+1)
for a in A:
    if cnt[a] != 0:
        cnt[a] += 1
        continue
    for i in range(10**6+1)[a::a]:
        cnt[i] += 1
ans = 0
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)
# Judge status: Accepted
a,b,c,d= map(int,input().split())
print('Yes' if -d<=c-a<=d or (-d<=b-a<=d and -d<=c-b<=d) else 'No')
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int, input().split()))
wlists = collections.Counter(A)
sum_num = 0
for i in wlists:
  sum_num += wlists[i] * (wlists[i] - 1) // 2
for i in range(N):
  num = sum_num - wlists[A[i]] * (wlists[A[i]] - 1) // 2
  if wlists[A[i]] > 1:
    num += (wlists[A[i]] - 1) * (wlists[A[i]] - 2) // 2
  print(num)
# Judge status: Wrong Answer
N = int(input())
ans = 0
for i in range(1,N+1):
    ans += i
    for j in range(1,int(i**0.5)+1):
        if i % j == 0:
            ans += i
        else:
            pass

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

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(20):
    c = 0
    for j in range(n):
        c += int(a[j] & 1)
        a[j] //= 2
    ans = (ans + c * (n - c) * (2 ** i)) % mod

print(ans)
# Judge status: Accepted


def main():
    s = input()
    ans = 0
    i = 0
    prev = ''
    while i < len(s):
        c = s[i]
        if c == prev:
            i += 1
            if i == len(s):
                break
            c += s[i]
        prev = c
        i += 1
        ans += 1
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import Counter
n = int(input())
a = Counter([int(input()) for i in range(n)])
ans = 0
for num, c in a.items():
    if c%2==1:
        ans+=1
print(ans)
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())

x = I()

q = (x-1)//11
r = (x-1) % 11
print(2*q+1 if r <= 5 else 2*q+2)
# Judge status: Accepted
# coding: utf-8
N, M = map(int, input().split())
A = list(map(int, input().split()))
homeworkDays = sum(A)
if homeworkDays > N:
    print("-1")
else:
    print(N - homeworkDays)
# Judge status: Accepted
from itertools import accumulate

n, q = map(int, input().split())
s = input()

t = [0] * n
for i in range(n - 1):
    if s[i] + s[i + 1] == "AC":
        t[i] = 1

a = [0] + list(accumulate(t))
for i in range(q):
    l, r = map(int, input().split())
    print(a[r - 1] - a[l - 1])
# Judge status: Wrong Answer
n = int(input())
A = list(map(int,input().split()))

col = [0 for _ in range(9)]
for a in A:
  if a >= 3200:
    col[8] += 1
    continue
  col[a//400] = 1
print(sum(col[:-1]), sum(col))
# Judge status: Wrong Answer
import random
A = random.randint(1,100)
B = random.randint(1,100)
print(A * B)
# Judge status: Wrong Answer
line = input()

a, b, c = [int(n) for n in line.split()]
k = int(input())

max_val = max(a, b, c)
max_val_mem = max_val

amax = False
bmax = False
cmax = False

for _ in range(k):
    max_val *= 2

if max_val_mem == a:
    amax = True
    print(str(max_val+ b+ c))
if max_val_mem == b:
    bmax = True
    print(str(max_val+ a+ c))
if max_val_mem == c:
    cmax = True
    print(str(max_val+ a+ b))
# Judge status: Accepted
def A():
    temp = input().split()
    S = temp[0]
    T = temp[1]
    temp = [int(i) for i in input().split()]
    A = temp[0]
    B = temp[1]
    U = input()
    if U == S:
        print(A-1, B)
    else:
        print(A, B-1)

def B():
    print('x'*len(input()))

def C():
    N = int(input())
    A = [int(i) for i in input().split()]
    if N > len(set(A)):
        print('NO')
    else:
        print('YES')
        
C()
# Judge status: Accepted
def solve(X:int) -> int:
    if(X < 100):return 0
    first = int(str(X)[-1])
    seccond = int(str(X)[-2])
    ans = 0
    if(first >= 6):
        ans += first + 200
    elif(first > 0):
        ans += first + 100
    ans += (seccond * 2) * 105
    return 1 if(ans <= X) else 0


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

if __name__ == "__main__":
    main()
# Judge status: Accepted
mod = 10 ** 9 + 7

# permutation
def prm(n,k,mod=10**9+7):
    res = 1
    for i in range(k):
        res = res * (n-i) % mod
    return res

def cmb(n,k,mod=10**9+7):
    return prm(n,k) * pow(prm(k,k),mod-2,mod) % mod

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

#何も選ばない1通りを除く
ans = pow(2,n,mod) - 1 - cmb(n,a) - cmb(n,b)
print(ans % mod)
# Judge status: Accepted
N, A, B = map(int,input().split())
su =0
for i in range(1,N+1):
  si = str(i)
  c = 0
  for s in si:
    c += int(s)
  if A <= c <= B:
    su += i
print(su)
# Judge status: Wrong Answer
N,T=map(int,input().split())
a=T+1
for i in range(N):
    c,t=map(int,input().split())
    if t<=T and c<a:a=c
print(a if a!=T+1 else 'TLE')
# Judge status: Accepted
n=int(input())
p=float("INF")
for i in range(5):
  p=min(p,int(input()))
if n%p==0:
  print(n//p+4)
else:
  print(n//p+5)
# Judge status: Accepted
taikai = input()
if taikai == 'ARC':
    print('ABC')
elif taikai == 'ABC':
    print('ARC')
# Judge status: Wrong Answer
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

A,B,X = LI()
if A + B >= X:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N, K = map(int, input().split())
D = set(map(int, input().split()))
digits = list({0, 1, 2, 3, 4, 5, 6, 7, 8, 9} - D)

N = str(N)
res = 0
for c in N:
    n_digit = int(c)
    if n_digit <= digits[0]:
        res = res*10 + digits[0]
        continue

    if len(digits):
        for i in range(1, 10-K):
            if n_digit <= digits[i] and n_digit > digits[i-1]:
                res = res*10 + digits[i]
                break

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

if N > 999:
    print('ABD')
else:
    print('ABC')
# Judge status: Accepted
a, b = map(int, input().split())

if a == b:
    print(a*2)
else:
    print(max(a, b)*2-1)
# Judge status: Accepted
n = int(input())

X_min = float("inf")
X_max = -float("inf")
Y_min = float("inf")
Y_max = -float("inf")

for _ in range(n):
    x, y = map(int, input().split())
    X = x - y
    Y = x + y
    X_min = min(X_min, X)
    X_max = max(X_max, X)
    Y_min = min(Y_min, Y)
    Y_max = max(Y_max, Y)

print(max(X_max-X_min, Y_max-Y_min))
# Judge status: Accepted
n = int(input())
sp = []
for i in range(n):
    s, p = input().split()
    sp.append((s, -int(p), i))#sortedが昇順になるためpを-にする

res = sorted(sp)
for i in range(n):
    print(res[i][2]+1)
# Judge status: Accepted
N=int(input())
As=list(map(int,input().split()))

Ans=1
if As.count(0):
    print(0)
    exit()
else:
    for A in range(N):
        if Ans>10**18:
            Ans=-1
            print(Ans)
            exit()
        else:
            NewAns=Ans*As[A]
            Ans=NewAns
    if Ans>10**18:
        Ans=-1
    
    print(Ans)
# Judge status: Accepted
import bisect
n = int(input())
a = list(map(int, input().split()))
a.sort()
ci = a[-1]
index = bisect.bisect_left(a, ci/2)
if abs(a[index]-ci/2)<abs(a[index-1]-ci/2):
    print(ci, a[index])
else:
    print(ci, a[index-1])
# Judge status: Wrong Answer
num = int(input())
count = 0
tmp = 0
for i in range(num):
    d1, d2 = map(int,input().split())
    if d1 == d2 and tmp == 0:
        count = 1
        tmp += 1
    elif d1 == d2 and tmp > 0:
        count += 1
        tmp += 1
    else:
        tmp = 0

print("Yes" if count >= 3 else "No")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
 
ans = 1
mode = 0
for i in range(N-1):
  if mode == 0:
    if A[i] < A[i+1]:
      mode = 1
    elif A[i] > A[i+1]:
      mode = -1
    else:
      mode = 0
  if mode == 1:
    if A[i] > A[i+1]:
      ans += 1
      mode = 0
  elif mode == -1:
    if A[i] < A[i+1]:
      ans += 1
      mode = 0
  else:
    pass
print(ans)
# Judge status: Accepted
N = int(input())
v_list = sorted(list(map(int,input().split())))

sum = 0
a = 0

if N == 1:
    sum += v_list[0]

elif N == 2:
    sum += (v_list[0] + v_list[1])/2

else:
    sum += (v_list[0] + v_list[1]) * 2 ** (-N + 1)
    for i in range(N-2):
        sum += v_list[i+2] * 2 ** (-N + i + 2)
        
print(sum)
# Judge status: Accepted
n = int(input())
mod = 10**9+7
print((10**n-2*(9**n)+(8**n))%mod)
# Judge status: Accepted
N = int(input())

numbers = [n for n in range(1, N + 1) if n % 3 != 0 and n % 5 != 0]
print(sum(numbers))
# Judge status: Accepted
A, B, K = map(int, input().split())
l = []
for i in range(1, min(A, B) + 1):
  if A % i == 0 and B % i == 0:
    l.append(i)
print(l[-K])
# Judge status: Wrong Answer
n,m = map(int, input().split())

al = [list(input()) for _ in range(n)]
bl = [list(input()) for _ in range(m)]

def same(h,w):
    for hi in range(m):
        for wi in range(m):
            if al[h+hi][w+wi]!=bl[hi][wi]:
                return False
    return True


for hi in range(n-m):
    for wi in range(n-m):
        if same(hi,wi):
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
n = int(input())
if n % 2 == 1:
    print(0)
    exit()

n = n // 10
score = n
while n > 4:
    n //= 5
    score += n
print(score)
# Judge status: Accepted
S = input()
f = False
for i in range(len(S)-1):
    if S[i] == S[i + 1]:
        f = True
        break
if f:
    print("Bad")
else:
    print("Good")
# Judge status: Wrong Answer
N,M = map(int,input().split())
A = list(map(int,input().split()))

sumOfA = sum(A)

condition = sumOfA//(4*M)


flag = 0
for i in A:
    if(i >= condition):
        flag += 1 
    else:
        continue

    if(flag==M):
        print("Yes")
        break

if(flag < M):
    print("No")
# Judge status: Wrong Answer
num1, num2 = map(int, input().split())

def factor(num):
  l = []
  for i in range(2,num+1):
    if num%i==0:
      l.append(i)
  return l

l1 = factor(num1)
l2 = factor(num2)
l1 = l1+l2
l = set(l1)

ans = 1
for _ in l:
  ans = ans * _
  
print(ans)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())

if abs(a-b) < d and abs(b-c) < d:
  print("Yes")
print("No")
# Judge status: Accepted
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
c = [list(map(int, input().split())) for i in range(m)]
for i in range(n):
    dim, num = 10**10, -1
    for j in range(m):
        if abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1]) < dim:
            dim = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1])
            num = j
    print(num+1)
# Judge status: Wrong Answer
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
a = set([I() for _ in range(M)])
dp = [0]*(N+1) #1_indexed
dp[0] = 1
dp[1] = 0 if 1 in a else 0
for i in range(2,N+1):
    if i in a:
        dp[i] = 0
        continue
    dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
print(dp[-1])
# Judge status: Accepted
x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)

p = p[:x]
q = q[:y]

s = p+q+r
s.sort(reverse=True)

print(sum(s[:(x+y)]))
# Judge status: Wrong Answer
x = input()
ls_x = x.split()

# print(ls_x)

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

gA = [1,3,5,7,8,10,12]
gB = [4,6,9,11]

if ls_x[0] == 2 or ls_x[1] == 2:
    print("No")

if ls_x[0] == gA[i] and ls_x[1] == gA[i]:
    print("Yes")
else:
    print("No")

if ls_x[0] == gB[i] and ls_x[1] == gB[i]:
    print("Yes")
else:
    ("No")
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1,n+1):
    if i%3!=0 and i%5!=0:
        ans += i
    else:
        continue
print(ans)
# Judge status: Accepted
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
mx = 0
for idx in range(n) :
    list = a1[:idx+1] + a2[idx:]
    mx = max(mx, sum(list))
print(mx)
# Judge status: Wrong Answer
N,P = map(int,input().split())
A = list(map(int,input().split()))

odd = 0
for v in A:
    if  v % 2:
        odd += 1 
even = N-odd

print((2**even)*int(2**(odd-1)))
# Judge status: Wrong Answer
N=int(input())
P= list(map(int, input().split()))
Q= list(map(int, input().split()))
dic=[]
Pn=0
Qn=0
import itertools
import numpy
l=numpy.arange(1,N+1,1,int)
for v in itertools.permutations(l, N):
  dic.append(v)
for i in range(len(dic)):
  if list(dic[i])==P:
    Pn=i
  elif list(dic[i])==Q:
    Qn=i
  elif Pn!=0 and Qn!=0:
    break
print(abs(Pn-Qn))
# Judge status: Accepted
a, b, c= input().split()
a, b, c= int(a), int(b), int(c)

if (a==b and c==b) or (a!=b and b!=c and c!=a):
	print('No')
else:
	print('Yes')
# Judge status: Accepted
n = int(input())
s_lsit = {}
cnt = 0
for i in range(n):
    s = list(input())
    s.sort()
    s = "".join(s)
    if s in s_lsit:
        cnt += s_lsit[s]
        s_lsit[s] += 1
    else:
        s_lsit[s] = 1
print(cnt)
# Judge status: Wrong Answer
import math
H, W = list(map(int, input().split()))

sum = float(H*W)

if sum%2 == 0:
    print(H*W//2)
else:
    print(math.floor(H*W/2)+1)
# Judge status: Wrong Answer
h1,h2,m1,m2,k = map(int,input().split())

a = 60*h2 + m2
b = 60+h1 + m1
print(a-b-k)
# Judge status: Accepted
l = []
for i in range(5):
    l.append(int(input()))
k = int(input())
ok = True
for i in range(5):
    for j in range(5):
        if i == j: continue
        diff = abs(l[i] - l[j])
        if diff > k:
            ok = False
if ok: print('Yay!')
else: print(':(')
# Judge status: Accepted
from collections import Counter
N=int(input())
A=list(map(int, input().split()))
C=Counter(A)
L=[]
R=[]
for i in C:
  l=C.get(i)
  if l>=2:
    L.append(i)
    if l>=4:
      R.append(i)
L.sort()
R.sort()

ans=0

if len(L)>=2:
  ans=max(L[-1]*L[-2], ans)
if len(R)>=1:
  ans=max(R[-1]**2, ans)
print(ans)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

d=[]
for i in range(N):
    d.append(a[i]-b[i])

cnt=-sum(d)
p=0
n=0
for j in range(N):
    if d[j]>0:
        p+=d[j]
    if d[j]<0:
        n+=-d[j]/2
if p<=cnt and n<=cnt:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
#!python3.8
# -*- coding: utf-8 -*-
# abc179/abc179_b
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    return

main()
# Judge status: Accepted
import itertools
n = int(input())
sp = str(list(map(int,input().split())))
sq = str(list(map(int,input().split())))

d = [i+1 for i in range(n)]

p = list(itertools.permutations(d))


order_dict = {}
for i in range(len(p)):
    order_dict[str(p[i])] = i

sp_str = sp.replace('[', '(').replace(']',')')
sq_str = sq.replace('[', '(').replace(']',')')

print(abs(order_dict[sq_str] - order_dict[sp_str]))
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a == b:
  print(a + b)
else:
  print(max(a, b) * 2 + 1)
# Judge status: Accepted
S=input()
if S=='SUN':
    print(7)
elif S=='MON':
    print(6)
elif S=='TUE':
    print(5)
elif S=='WED':
    print(4)
elif S=='THU':
    print(3)
elif S=='FRI':
    print(2)
elif S=='SAT':
    print(1)
# Judge status: Accepted
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
l = [0] * n

for i in range(n):
    if t[i] == 'r':
        l[i] = p
    elif t[i] == 's':
        l[i] = r
    else:
        l[i] =s

ans = sum(l)
for i in range(k, n):
    if t[i] == t[i - k]:
        ans -= l[i]
        t[i] = 'o'

print(ans)
# Judge status: Accepted
s = input()
t = input()

if s == t[:-1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s = input()
if 'N' in s and 'W' in s and 'S' in s and 'E' in s:
    print('Yes')
elif 'N' in s and 'W' in s and 'S' not in s and 'E' not in s:
    print('Yes')
elif 'N' not in s and 'W' not in s and 'S' in s and 'E' in s:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
MOD = 1000000007
 
s = [0]*2020
s[0]=1
s[1]=0
s[2]=0
for i in range(3,n+1,1):
  s[i] = (s[i] + sum(s[:(i-2)])) % MOD
print(s[n])
# Judge status: Accepted
n, k, s = map(int, input().split())

ans = [s for _ in range(k)]
if s == 10**9:
  ans += [1 for _ in range(n - k)]
else:
  ans += [s+1 for _ in range(n - k)]

print(*ans)
# Judge status: Wrong Answer
n=int(input())
ans=""
while n!=0:
  if (n%2)!=0:
    n-=1
    ans="1"+ans
  else:
    ans="1"+ans
  n/=-2
if ans=="":
  ans="0"
print(ans)
# Judge status: Wrong Answer
n = int(input())

l = []
cnt = 1
for i in range(1, n):
  cnt *= i
  print(i)
# Judge status: Wrong Answer
import sys

def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def S(): return sys.stdin.readline().rstrip()

N,M = map(int,S().split())
AB = [tuple(LI()) for i in range(N)]

from operator import itemgetter

AB = sorted(AB,key = itemgetter(1,0),reverse=True)

ANS = []

# 価値が大きく、報酬までの時間が長いものから貪欲に

r = M
for i in range(N):
    a,b = AB[i]
    if a <= r:
        ANS.append(b)
        r -= 1

print(sum(ANS))
# Judge status: Accepted
import copy
from collections import Counter

l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
c = Counter

def nC2(n):
    if n < 2:
        return 0
    else:
        return n*(n-1)//2

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

count = 0
C = Counter(A)
for num in C.values():
    count += num*(num-1)//2
#print(count)

for a in A:
    print(count - (C[a] - 1))
# Judge status: Wrong Answer
import sys
 
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
 
 
N=int(input())
cnt=0
 
for i in range(1,N):
	for j in range(1,N):
		if str(i)[0]==str(j)[-1] and str(i)[-1]==str(j)[0]:
			cnt+=1
 
print(cnt)