peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
from itertools import permutations
N = int(input())
L = list(map(int, input().split()))
ans = 0
for l in permutations(L, 3):
    if set(l) != 3:
        continue
    a = l[0]
    b = l[1]
    c = l[2]
    if a + b > c and b + c > a and c + a > b:
        ans += 1
print(ans)
# Judge status: Accepted
N, M = list(map(int, input().split()))

if N % 2 == 1:
  for i in range(M):
    print(1 + i, N - i)
else:
  n = N // 2
  c = 1
  for i in range(M - 1, -1, -2):
    print(c, c + i + 1)
    c += 1
  c = n + 1
  for i in range(M - 2, -1, -2):
    print(c, c + i + 1)
    c += 1
# Judge status: Accepted
N = int(input())

y = 0
M = 100

while (M < N):
    y += 1
    M *= 1.01
    M = int(M)

print(y)
# Judge status: Wrong Answer
n, d = map(int, input().split())

cnt = 0
for i in range(d, n, d*2):
    cnt += 1

print(cnt+1)
# Judge status: Accepted
n,k = map(int,input().split())
input()
print(1 if n==k else 1+(n-2)//(k-1))
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
x, a, b = M()
if abs(x-a) < abs(x-b):
    print('A')
else:
    print('B')
# Judge status: Wrong Answer
n,m,x,y = map(int,input().split())
d = "War"
l_x = sorted(list(map(int,input().split())))[::-1]
l_y = sorted(list(map(int,input().split())))
for i in range(x+1,y+1):
  if l_x[0]<=i and l_y[0]>=i:
    d = "No War"
    break
print(d)
# Judge status: Wrong Answer
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
p = set(map(int, input().split()))

i = 1
while True:
  if x - i not in p:
    print(x-i)
    break
  elif x + i not in p:
    print(x+i)
    break
  
  i += 1
# Judge status: Wrong Answer
from math import factorial as fac
n = int(input())
D = list(map(int,input().split()))
mod = 998244353
ans = 1

if D.count(0)!=1:
    print(0)
else:
    for i in range(max(D)):
        ans *= fac(D.count(i))%mod
    print(ans)
# Judge status: Wrong Answer
S = input().split()
if S=='ARC':
    print('ABC')
else:
    print('ARC')
# Judge status: Accepted
n = int(input())
H = list(map(int, input().split()))

dp = [0] * n

for i in range(n):
    if i == 0:
        dp[i] = 0
    elif i == 1:
        dp[i] = abs(H[0] - H[i])
    else:
        dp[i] = min(
            dp[i - 2] + abs(H[i - 2] - H[i]),
            dp[i - 1] + abs(H[i - 1] - H[i])
            )

print(dp[-1])
# Judge status: Accepted
import math
import itertools
import numpy as np

def solve():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        if len(str(i)) % 2 == 1:
            ans += 1
    print(ans)
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print (0) if c%2 == 0 else print (a*b)
# Judge status: Accepted
from collections import deque

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

adj = [[] for i in range(n+1)]
dist = [-1]*(n+1)

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

d = deque([[1,0]])

while len(d) > 0:
    x,y = d.popleft()
    if dist[x] != -1:
        continue
    
    dist[x] = y
    
    for n in adj[x]:
        if dist[n] == -1:
            d.append([n,x])

print("Yes")

for i in dist[2:]:
    print(i)
# Judge status: Accepted
A,B,C = map(int,input().split(" "))
if (A+B)>=C:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, M = map(int, input().split())
digits = [-1 for _ in range(N+1)]
for __ in range(M):
  digit, num = map(int, input().split())
  if digit == 1 and num == 0 and N != 1:
    print(-1)
    exit()
  elif digits[digit] != -1 and num != digits[digit]:
    print(-1)
    exit()
  else:
    digits[digit] = num
answer = 0
for i in range(1, N+1):
  if digits[i] == -1:
    if i == 1 and N != 1:
      answer += 1*10**(N-i)
  else:
    answer += digits[i]*10**(N-i)
print(answer)
# Judge status: Wrong Answer
N=int(input())
V=list(map(int,input().split()))
V=sorted(V)
ans=V[0]
for i in range(1,N-1):
  ans=(ans+V[i])/2
print(ans)
# Judge status: Accepted
def main():
    X = int(input())
    if X <= 3:
        print(1)
        return
    
    ans = 0
    for n in range(2, X):
        p = 2
        while pow(n, p) <= X:
            if ans < pow(n, p):
                ans = pow(n, p)
            p += 1
    print(ans)
    
main()
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
za = 0
zb = 0
zc = 0

d = 0

if a == b == c:
    print(-1)
    exit()
elif not(a % 2 == 0 and b % 2 == 0 and c % 2 ==0):
    print(0)
    exit()


while a % 2 == 0 and b % 2 == 0 and b % 2 == 0:

    za = a
    zb = b
    zc = c

    a = zb // 2 + zc // 2
    b = za // 2 + zc // 2
    c = za // 2 + zb // 2

    d += 1

print(d)
# Judge status: Accepted
n,d = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(n)]

def dist_squere(x, y):
    d = 0
    for i,j in zip(x,y):
        d += (i-j)**2
    return d

squares = set([i*i for i in range(10000)])
def is_square(x):
    return x in squares

from itertools import combinations

ans = 0
for x,y in combinations(X, 2):
    if is_square(dist_squere(x, y)):
        ans += 1

print(ans)
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]

A.append(0)
ans = 0

for i in range(N):
  ans += A[i] // 2
  if A[i + 1] != 0:
    A[i + 1] += A[i] % 2

print(ans)
# Judge status: Accepted
s=input()
print('AC' if s[0] == 'A' and s[2:-1].count('C') ==1 and s[1:].replace('C','',1).islower() else 'WA')
# Judge status: Accepted
N = int(input())
A = tuple(map(int, input().split()))

d = dict()
for a in A:
    d.setdefault(a, 0)
    d[a] += 1

counts = 0
for k, v in d.items():
    counts += v*(v-1)//2

for k in range(0, N):
    ak = A[k]
    print(counts - d[ak] + 1)
# Judge status: Accepted
a = int(input())
print((a//2)*(a-a//2) )
# Judge status: Accepted
import sys

N = int(input())

for i in range(1, 10):
    for j in range(1, 10):
        if i * j == N:
            print("Yes")
            sys.exit()
print("No")
# Judge status: Accepted
N = int(input())

ans = []
sum = 0
for i in range(1,N+1):
  sum += i
  ans += [i]
  if sum > N:
    ans.remove(sum-N)
    break
for i in ans:
  print(i)
# Judge status: Accepted
#!/usr/bin/env python3

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

N = int(input())

D = make_divisors(N)

ans = 10**12+1
for d in D:
    b = N//d
    if d + b < ans:
        ans = d + b
print(ans-2)
# Judge status: Wrong Answer
x = int(input())
dp = [0]*(x + 105 + 1)
dp[100] = 1 
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1

for i in range(100,x-105+5):
    for j in range(100,106):
        dp[i+j] = max(dp[i] , dp[i+j])

print(dp[x])
# Judge status: Accepted
n=int(input())
a=-(-n//4)
ans = 'No'
if n%4==0:
    ans = 'Yes'
else:
    for i in range(a):
        if (n-4*i)%7==0:
            ans = 'Yes'
            break
print(ans)
# Judge status: Wrong Answer
from collections import Counter

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

B = set(A)
A = Counter(A)
print(A)
ans = 0
keep = 0

for i in B:
    kazu = A[i]
    if kazu >= 4:
        ans = i**2
        keep = i
    elif kazu >= 2:
        ans = keep * i
        keep = i
print(ans)
# Judge status: Accepted
import math

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

path = 0
lastPosition = 0

for i in range(KN[1]):
    if (i == 0):
        path = KN[0] + A[0] - A[KN[1] - 1]
        lastPosition = A[0]
    else:
        currentPosition = A[i]
        if (path < currentPosition - lastPosition):
            path = currentPosition - lastPosition
        lastPosition = currentPosition

print(KN[0] - path)
# Judge status: Wrong Answer
n = int(input())
l = list(map(int,input().split()))
l.sort()
if sum(l[:n-2]) > l[n-1]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import numpy as np
N = int(input())
# = map(int, input().split())
A = np.array(list(map(int, input().split())))
Q = int(input())
BC = [list(map(int, input().split())) for i in range(Q)]

zero = np.zeros(10**5+1)
total = np.sum(A)
#print(total)
for i in A:
    zero[i] += 1

for j in range(Q):
    total += (BC[j][1]-BC[j][0])*zero[BC[j][0]]
    zero[BC[j][1]] += zero[BC[j][0]]
    zero[BC[j][0]] = 0
    print(int(total))
# Judge status: Accepted
t = list(map(int,input()))
print(str(t.count(1)))
# Judge status: Wrong Answer
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
for k in range(y):
    print("U")
for k in range(x+1):
    print("R")
for k in range(y+1):
    print("D")
for k in range(x+1):
    print("L")
print("U")
print("L")
for k in range(y+1):
    print("U")
for k in range(x+1):
    print("R")
for k in range(y+1):
    print("D")
for k in range(x):
    print("L")
# Judge status: Wrong Answer
import math
n=int(input())
csf=[list(map(int,input().split())) for _ in range(n-1)]

ans=[0]*n
ans[n-2]=csf[n-2][0]+csf[n-2][1]
for i in range(n-3,-1,-1):
    p=csf[i][0]+csf[i][1]
    if p<=csf[i+1][1]:
        ans[i]=ans[i+1]
    else: ans[i]=math.ceil(p/csf[i+1][2])*csf[i+1][2]+ans[i+1]-csf[i+1][1]

for i in range(n):
    print(ans[i])
# Judge status: Accepted
n = int(input())
l = [int(_) for _ in input().split()]
l = sorted(l)
a = l[n // 2 - 1]
b = l[n // 2]
print(b - a)
# Judge status: Accepted
X = int(input())
for A in range(-1000,1000):
    A5 = A**5
    for B in range(-1000,1000):
        if A5 - B**5 ==X:
            print(A,B)
            exit()
# Judge status: Wrong Answer
t = list(input())
temp = ''

for i, s in enumerate(reversed(t)):
    if s == '?' and temp == 'D':
        t[len(t)-i-1] = 'P'
    elif s == '?' and temp == 'P':
        t[len(t)-i-1] = 'D'
    elif s == '?' and len(t) == len(t)-i:
        t[len(t)-i-1] = 'D'
    temp = s

print(*t, sep='')
# Judge status: Accepted
N = int(input())
cnt = 0
for i in range(N//4 + 1):
    if (N - 4 * i) % 7 == 0:
        print('Yes')
        break
    else:
        cnt += 1

if cnt == N//4 + 1:
    print('No')
# Judge status: Accepted
from collections import defaultdict

N = int(input())

if N == 1:
    print(0)
    exit()

e = defaultdict(int)
for i in range(2, int(N ** 0.5) + 1):
    while N % i == 0:
        e[i] += 1
        N //= i
if N != 1:
    e[N] += 1


if len(e) == 0:
    print(1)
    exit()

ans = 0
for k, v in e.items():
    tmp = 0
    i = 0
    while tmp + i + 1 <= v:
        i += 1
        tmp += i
    ans += i

print(ans)
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))
ans = 10**9
b = [i for i in range(-100,101)]
for i in range(len(b)):
    ansa = 0
    for j in range(N):
        ansa += (b[i]-a[j])**2
    ans = min(ans,ansa)
print(ans)
# Judge status: Accepted
import math

input =raw_input
h = int(input())
w = int(input())
n = float(int(input()))

out = int(math.ceil(n / max(w, h)))
print(out)
# Judge status: Accepted
s = input()
t = input()

if "".join(sorted(s)) < "".join(sorted(t, reverse=True)):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
ans = 1
while ans*2<=n:
  ans *=2
print(ans)
# Judge status: Accepted
import math
x = int(input())
ans = min((x//11)*2 + math.ceil((x%11)/5),(x//11)*2 + math.ceil((x%11)/6))
print(ans)
# Judge status: Accepted
s = sorted(input())
t = sorted(input())[::-1]
print("Yes" if s < t else "No")
# Judge status: Accepted
# ABC146 B - ROT N
N = int(input())
S = str(input())
s=''
alp = ['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 range(len(S)):
    t =alp.index(S[i])+N
    if t>=26:
        t -=26
    s += alp[t]
print(s)
# Judge status: Accepted
N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]
 
for i in range(N):
  for j in range(W+1):
    if j - wv[i][0] >= 0:
      dp[i+1][j] = max(dp[i+1][j], dp[i][j-wv[i][0]] + wv[i][1])
    dp[i+1][j] = max(dp[i+1][j], dp[i][j])
 
ans = 0

print(dp[N][W])
# Judge status: Wrong Answer
n,m = map(int, input().split())

if n == 1 and m == 1: print(1)
elif n == 1 and m != 1: print(m-2)
else: print((n-2)*(m-2))
# Judge status: Accepted
n, k = map(int, input().split())
A = list(map(int, input().split()))
mi = A.count(min(A))
ans = (n - mi)//(k - 1)
if (n - mi)%(k - 1) != 0:
    ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
t = 0
x = 0
y = 0
for i in range(N):
  T,X,Y = map(int,input().split())
  dt = T - t
  dist = abs(X-x) + abs(Y - y)
  if dist > dt:
    print("No")
    break
  if dist%2 != dt%2:
    print("No")
    break
  t = T
  x = X
  y = Y
  if i == N - 1:
    print("Yes")
# Judge status: Wrong Answer
s = input()
print("ABC" if s == "ARC" else "ABC")
# Judge status: Accepted
s=str(input())
if(s[-1]=='s'):
    s=s+'es'
else:
    s=s+'s'
print(s)
# Judge status: Wrong Answer
N = int(input())
A = map(int, input().split())

curr = 0
ans = 0
for a in A:
  if curr < a:
    curr = a
    ans += a-curr
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = [int(x) for x in input().split()]

mod = 10**9 + 7
x = sum(A)
y = x**2 - sum([x**2 for x in A])
print(int(y / 2) % mod)
# Judge status: Wrong Answer
s = list(input())
k = int(input())
b = "abcdefghijklmnopqrstuvwxyz"
n = len(s)
for i in range(n):
  dp = b.find(s[i])
  if k >= 26-dp:
    k-=26-dp
    s[i] = "a"
    if k == 0:
      break
else:
  s[-1] = b[(b.find(s[-1])+k)%26]
print("".join(s))
# Judge status: Accepted
t,s=0,0
for x in input():
 if x=='S':s+=1
 elif s:s-=1
 else:t+=1
print(t+s)
# Judge status: Wrong Answer
n, w = map(int, input().split())
we,v = [0] * n, [0] * n
for i in range(n):
    we[i], v[i] = map(int, input().split())

dp = [[0] * (w + 1) for i in range(n + 1)]
for i in range(n):
    for j in range(w + 1):
        if j - we[i] >= 0:
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - we[i]] + v[i])
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
    
print(dp)
# Judge status: Accepted
import sys
n = [int(i) for i in input().split()]
if n[0] <= n[2]:
    if n[1] >= n[2]:
        print('Yes')
        sys.exit()
print('No')
# Judge status: Wrong Answer
arr=map(int,raw_input().split())
for i in range(len(arr)):
  if arr[i]==9:
    print "Yes"
  else:
    print "No"
# Judge status: Accepted
a,b,c=map(int,input().split())
if a+b==c or a+c==b or b+c==a:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
from bisect import bisect_left


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

bc = [tuple(map(int,input().split())) for i in range(m)]
bc = sorted(bc, reverse=True, key=lambda x: x[1])

i = 0
c_card = []
for b, c in bc:
    c_card.extend([c]*b)
    if len(c_card)+b > n:
        break

print(c_card)

ans = 0
for i in range(n):
    if i >= len(c_card):
        ans += a[i]
    else:
        ans += max(a[i], c_card[i])

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

sq = math.sqrt(M)
sq = math.floor(sq)


ans = 1
for i in range(1,sq+2):
  if M % i == 0:
    if i * N <= M:
      ans = max(i,ans)
    if M // i * N <= M:
      ans = max(i,ans)
if N == 1:
  print(int(M))
else:
  print(int(ans))
# Judge status: Accepted
k,s=map(int, input().split())
cnt=0
for p in range(k+1):
  for q in range(k+1):
    r=s-p-q
    if 0<=r<=k:
      cnt+=1
print(cnt)
# 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()))

r += sorted(p)[-x:]
r += sorted(q)[-y:]
ans = sum(sorted(r)[-(x + y):])

print(ans)
# Judge status: Wrong Answer
n = int(input())
list = [2**i for i in range(6)]

ans = 1

for k in list:
  if k <= n:
    ans = k
    continue
  else:
    print(ans)
    break
# Judge status: Wrong Answer
K, X = map(int, input().split())
print((K - 1) * 2 + 1)
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
a = Counter(map(int, input().split()))
xy = []
a = sorted(a.items(), key=lambda x: x[0], reverse=True)
for i in a:
    if len(xy) == 2:
        break
    if i[1] >= 2:
        xy.append(i[0])
    else:
        pass
print(xy[0] * xy[1]) if len(xy) == 2 else print(0)
# Judge status: Accepted
# D - Semi Common Multiple

import fractions
from functools import reduce

N, M = map(int, input().split())
a = list(map(int, input().split()))
a_d = [x//2 for x in a]

def lcm(x,y):
    return x*y//fractions.gcd(x,y)

l = reduce(lcm, a_d)

for i in a_d:
    if (l//i) % 2 == 0: # 含まれる因数2の個数が異なるa_i, a_jがあるとき
        print(0)
        break
else:
    if (M//l) % 2 == 0:
        print((M//l)//2)
    else:
        print((M//l)//2 + 1)
# Judge status: Wrong Answer


N=int(input())

if len(str(N))==1:
    print(N)
    exit()
    

sum=0
if len(str(N))%2==0:
    for i in range(int(len(str(N))/2)):
        sum += 9*10**(i*2)
else:
    for i in range(len(str(N))//2):
        sum += 9*10**i
    sum += N-int("9"*(len(str(N))-1))

print(sum)
# Judge status: Wrong Answer
S = input()
N = len(S)
S = list(S)
a = S[:(N-1)//2]
b = S[(N+1)//2:]
ar = a[::-1]
br = b[::-1]
if a==ar and b == br:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import math
a, b, h, m = map(int, input().split())

rad_a = 360 * h / 12 + 30 * m / 60
rad_b = 360 * m / 60 

if rad_a == rad_b:
  print(float(0))
  
elif rad_a > rad_b:
  ans = a**2 + b **2 - 2*a*b*math.cos(math.radians(rad_a - rad_b))
  print(math.sqrt(ans))
else:
  ans = a**2 + b **2 - 2*a*b*math.cos(math.radians(rad_b - rad_a))
  print(math.sqrt(ans))
# Judge status: Wrong Answer
n,k=map(int,input().split())

ans=0
for i in range(1,n+1):
  num=i
  p=1/n
  while num<=k:
    num=num*2
    p=p*(1/2)
  ans+=p
  
print(ans)
# Judge status: Wrong Answer
n,m,x,y = map(int,input().split())
xl = list(map(int,input().split()))
yl = list(map(int,input().split()))
xl.sort(reverse = True)
yl.sort()

if xl[0] < yl[0]:
    p = yl[0]
    while p > x:
        if p <= y:
            print('No War')
            exit(0)
        p -= 1
    print('War')
else:
    print('War')
# Judge status: Wrong Answer
# 1 軒のホテルがあります。 このホテルの宿泊費は、次のようになっています。
# 最初の K 泊までは、 1 泊あたり X 円 K + 1 泊目以降は、 1 泊あたり Y 円 高橋君は、このホテルに N 泊連続で宿泊することにしました。
# 高橋君の宿泊費は合計で何円になるか求めてください。

N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N - K>= 1:
    print(X * K + Y * (N - K))

else:
    print(X * K)
# Judge status: Accepted
import collections

n = int(input())
li = list(map(int,input().split()))
c = collections.Counter(li)
ans = 0

for item in c.items():
    x = item[0] #要素
    y = item[1] #個数

    if x < y:
        ans += y-x

    if x > y:
        ans += y

print(ans)
# Judge status: Wrong Answer
#B
n=int(input())
ans=None
for i in range(1,46297):
    if int(i*1.08)==n:
        ans=i
        break
    if i==46296:
        ans=":("
print(ans)
# Judge status: Wrong Answer
n,k = map(int,input().split())
s = input()
temp = ''
ans,cnt = 0,0
for l in s:
  if temp=='L' and l=='R':
    cnt += 1
  elif temp==l:
    ans += 1
  temp = l
print(min(min(cnt,k)*2+ans,n-1))
# Judge status: Wrong Answer
en=int(input())

a=en/500
b=(en%500)/5

print(a*1000+b*5)
# Judge status: Wrong Answer
n = int(input())
bn = [int(num) for num in input().split()]

an = [0]*n
an[0] = bn[0]
an[n-1] = bn[n-2]
for i in range(1,n-1):
    s = min(bn[i],bn[i-1])
    an.append(s)
    
print(sum(an))
print(an)
# Judge status: Wrong Answer
K, X = map(int, input().split())
for i in range(max(-10**6, X - K + 1), min(10**6 + 1, X + K)):
  print(i, end='')
# Judge status: Accepted
x, y = map(int, input().split())
x_, y_ = x, y
ans = 0

def sign(n):
    if n == 0:
        return 0
    else:
        return int(n / abs(n))

if abs(x) > abs(y):
    if x > 0:
        x_ = -x
        ans += 1
else:
    if x < 0:
        x_ = -x
        ans += 1

ans += abs(abs(x) - abs(y))
x_ += abs(abs(x) - abs(y))
if sign(x_) != sign(y):
    ans += 1
print(ans)
# Judge status: Accepted
N=int(input())
print(int((N+1)*N/2))
# Judge status: Accepted
#!/usr/bin/env python3
import sys
s = input()
for i in range(len(s)//2):
    if s[i] != s[-1-i]:
        print("No")
        sys.exit()
s2 = s[:(len(s)-1)//2]
for i in range((len(s)-1)//2):
    if s2[i] != s2[-1-i]:
        print("No")
        sys.exit()
s3 = s[(len(s)+3)//2-1:]
for i in range((len(s)-1)//2):
    if s3[i] != s3[-1-i]:
        print("No")
        sys.exit()
print("Yes")
# Judge status: Accepted
n,a,b=map(int,input().split())
s=input()
d=[str(c) for c in s]
for i in range(n):
    if d[i]=="c":
        print("No")
    elif a+b==0:
        print("No")
    elif d[i]=="a":
        print("Yes")
        a-=1
    elif d[i]=="b":
        if b==0:
            print("No")
        else:
            print("Yes")
            b-=1
# Judge status: Wrong Answer
import math

def comb(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = (int)(input())
a = list(map(int, input().split(" ")))
temp = [0 for i in range(n + 1)]
aaa = sorted(a)
count = 0
for i in range(n - 1):
  if aaa[i] == aaa[i + 1]:
    count+= 1
  else:
    temp[aaa[i]] = count + 1
    count = 0
else:
  if len(a) == 1:
    temp[aaa[0]] = 1
  else:
    temp[aaa[-1]] = count + 1
ans = 0
#print(temp)#各数字の出現回数
# Judge status: Accepted
a = input()
b = input()
if a == b[::-1]:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
ans = 0
MOD = 10 ** 9 + 7
digit = 0

while A.any():
    one = np.count_nonzero(A & 1)
    ans += (one * (N - one) * pow(2, digit, MOD)) % MOD
    ans %= MOD
    A >>= 1
    digit += 1

print(ans)
# Judge status: Accepted
n = int(input())
a = [0]*n
h = list(map(int,input().split()))
ans = 0
for i in range(1,n):
    if h[i]<=h[i-1]: a[i] = a[i-1]+1
    else:
        a[i]=0
        ans = max(ans,a[i-1])
ans = max(ans,a[n-1])
print(ans)
# Judge status: Accepted
from functools import reduce

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

# nCr の計算
def F(n,r):
    # 分子 n*(n-1)*(n-2)*...(n-r+1)
    numerator = reduce(lambda x,y: x * y % MOD, range(n,n-r,-1))
    # 分母 r!(rの階乗)
    denominator = reduce(lambda x,y: x * y % MOD, range(1,r+1))
    return numerator * pow(denominator, MOD - 2, MOD) % MOD

# 繰り返し二乗法
ans = pow(2,n,MOD)-1
ans -=F(n,a)
ans -=F(n,b)
ans %= MOD

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

N=str(N)

if N[0]==7:
  print("Yes")
  
elif N[1]==7:
  print("Yes")

elif N[2]==7:
  print("Yes")
  
else:
  print("No")
# Judge status: Accepted
N=int(input())
#a*b+c=n

cnt=N-1
for a in range(2,N):
	if N%a==0:
		cnt+=(N//a)-1
	else:
		cnt+=N//a
		
print(cnt)
# Judge status: Wrong Answer
import heapq
import sys
from io import StringIO
import unittest


n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)

for _ in range(m):
	tmp_min = heapq.heappop(a)
	heapq.heappush(a, (-1) * (-tmp_min // 2))
	print(-sum(a))
# Judge status: Accepted
# A - Between Two Integers
# https://atcoder.jp/contests/abc061/tasks/abc061_a

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

if a <= c <= b:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
c11, c12, c13 = list(input())
c21, c22, c23 = list(input())

if c23 == c11 and c22 == c12 and c21 == c13:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer

def main():

    L, R = [int(i) for i in input().split()]

    tl = L % 2019
    tr = R % 2019
    c1 = (tl <= 673) & (673 <= tr)
    c2 = False
    for i in range(L, min(L + 3, R+1)):
        if i % 3 == 0:
            c2 = True
            break

    if ((L//2019) < (R//2019)) | (c1&c2):
        ans = 0
    else:
        t = L % 2019
        ans = t * (t+1)
    print(ans % 2019)



if __name__ == "__main__":
    main()
# Judge status: Accepted
S, W = map(int, input().split())

if W>=S:
    print('unsafe')
else:
    print('safe')
# Judge status: Accepted
K=int(input())
print((K//2)*((K+1)//2))