peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import copy
N,W=map(int,input().split())
Wlist=[]
Vlist=[]
for i in range(N):
  w,v=map(int,input().split())
  Wlist+=[w]
  Vlist+=[v]
dp0=[0 for p in range(W+1)] 
dp1=[0 for p in range(W+1)] 
dp1[Wlist[0]]=Vlist[0]
for i in range(1,N):
  wi=Wlist[i]
  for j in range(W):
    if j+wi<=W:
      dp1[j+wi]=max(dp0[j]+Vlist[i],dp1[j+wi])
    dp1[j]=max(dp0[j],dp1[j])
  dp0=copy.copy(dp1)
print(max(dp1))
# Judge status: Accepted
from collections import deque

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

d = deque()
for i in range(n):
    if n % 2 == (i + 1) % 2:
        d.appendleft(a[i])
    else:
        d.append(a[i])

print(*d)
# Judge status: Accepted
from collections import Counter

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

mod = 998244353
c = Counter(D)
m = max(c.keys())

if D[0] == 0 and c[0] == 1:
  ans = 1
  for i in range(1, m+1):
    ans *= c[i-1]**c[i] % mod
    ans %= mod
  print(ans)
else:
  print(0)
# Judge status: Accepted
Q, H, S, D = map(int, input().split())
N = int(input())

ans = (N//2) * min(8 * Q, 4 * H, S * 2, D) + (N % 2) * min(4 * Q, 2 * H, S)

print(ans)
# Judge status: Accepted
n = int(input())
d = list(map(int,input().split()))
m = max(d)
if(d[0] != 0 or m >= n):
    print(0)
else:
    s = [0] * (m+1)
    for i in d:s[i] += 1
    if(0 in s or s[0] != 1):
        print(0)
    else:
        t = 1
        for i in range(1,m+1):
            t *= s[i-1]**s[i]
            t %= 998244353
        print(t)
# Judge status: Accepted
import numpy as np
N = int(input())
A = []
i = 2
a = int()
b = int()
ans = 10**12+1
for i in range(2,int(np.sqrt(N))+1):
    if N%i ==0:
        A.append(i)

if len(A) == 0:
    print(N-1)
else:
    for j in range(len(A)):
        a = A[j]-1
        b = (N/A[j])-1
        if a+b <= ans:
            ans = a+b
    print(int(ans))
# Judge status: Accepted
n,m=map(int,input().split())
print(n+(m-n*2)//4 if m>n*2 else m//2)
# Judge status: Wrong Answer
N,K=map(int,input().split())
L=list(map(int,input().split()))
L=sorted(L)
print(sum(L[:-K]))
# Judge status: Wrong Answer
N = int(input())
num_list = list(map(int, input().split()))
count=0
for i in range(N):
  for j in range(N):
    if num_list[i] % num_list[j]==0:
      count = count + 1
      break
count = count - N
print(N-count)
# Judge status: Accepted
N = int(input())
if N == 25:
  print('Christmas')
elif N == 24:
  print('Christmas Eve')
elif N == 23:
  print('Christmas Eve Eve')
else:
  print('Christmas Eve Eve Eve')
# Judge status: Accepted
s = input()
count = 0
for i in range(len(s)):
  if s[i]=='1':
    count += 1
print(count)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if abs(a-b)==abs(c-b):
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N = int(input())
arr = list(map(int, input().split()))
ans = arr[0]

if 0 in arr:
    print(0)
    exit()

for i in range(1,N):
    ans *= arr[i]
    if ans > 10**18:
        print(-1)
        exit()

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

num =[[0] * 10 for _ in range(10)]

for n in range(1, N+1):
    s = str(n)
    a, b = map(int, [s[0], s[-1]])
    num[a][b] += 1

ans = 0
for a in range(1, 10):
    for b in range(1, 10):
        ans += num[a][b] * num[b][a]

print(ans)
# Judge status: Accepted
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N = int(input())

A = []
for i in range(N):
    A.append(list(map(int, input().split())))

A = sorted(A, key=lambda x: x[1])

t = 0
for i in range(N):
    t += A[i][0]
    if t > A[i][1]:
        print("No")
        sys.exit()

print("Yes")
# Judge status: Accepted
a, b, c = map(int, input().split())
if c >= a and c <= b:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import math
N = int(input())
ans = 0
A = [1 for i in range(N + 2)]
k = 2
A[1] = 0
while k <= math.sqrt(N):
    for i in range(k,N + 1,k):
        q = i
        p = 1
        while q % k == 0:
            q /= k
            p += 1
        A[i] *= p
    while A[k] != 1:
        k += 1
for i in range(1,N + 1):
    if A[i] <= 1:
        A[i] += 1
    ans += i * A[i]
print(ans)
# Judge status: Wrong Answer
from math import sqrt
from bisect import bisect_left

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


t = M
#約数全列挙
sep = [1]
for i in range(2,int(sqrt(M))+2,1):
    if M % i ==0:
        count = 0
        if M % i == 0:
            if N <= i and i <= t:
                t = i
            if N <= M//i and M//i <= t:
                t = M//i

print(M//t)
# Judge status: Accepted
s = int(input())
mod = 10 ** 9 + 7

dp = [1, 0, 0]
for _ in range(s - 2):
    dp.append((dp[-1] + dp[-3]) % mod)
print(dp[s])
# Judge status: Accepted
n = int(input())
s = input()
cnt_R = s.count('E')
cnt_L = 0
INF = 10**18
ans = INF
for x in s:
    if x == 'W':
        ans = min(ans, cnt_L+cnt_R)
        cnt_L += 1
    else:
        cnt_R -= 1
        ans = min(ans, cnt_L+cnt_R)
print(ans)
# Judge status: Wrong Answer
x = int(input())

flag = False
for ia in range(0, int(x/4)):
    for ib in range(0, int(x/4)):
        if 4 * ia + 7 * ib == x:
            flag = True
            break
    if flag:
        break

if flag:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
answer = 0
answer1 = 0

for i in range(max(a)):
  answer += a.count(i + 1) * (a.count(i + 1) -1) // 2

for k in range(n):
  if a.count(a[k]) > 2:
    answer1 = answer - (a.count(a[k]) - 1)
  print(answer1)
# Judge status: Accepted
def c_count_order():
    from itertools import permutations
    N = int(input())
    P = tuple(int(i) for i in input().split())
    Q = tuple(int(i) for i in input().split())

    rank = {perm: k for k, perm in enumerate(permutations(range(1, N + 1), N), 1)}
    return abs(rank[P] - rank[Q])

print(c_count_order())
# Judge status: Accepted

W, H, x, y = map(int, input().split())

print("{0} {1}".format(H * W / 2, int(x + x == W and y + y == H)))
# Judge status: Wrong Answer
n, k = map(int,input().split())
s = input()

press = []
temp = s[0]
cnt = 0
for string in s:
    if temp == string:
        cnt += 1
    else:
        press.append(cnt)
        temp = string
        cnt = 1
press.append(cnt)

if len(press) < 3 * k:
    print(n-1)
    exit()

ans = 2 * k
for i in press:
    ans += i - 1
print(ans)
# Judge status: Accepted
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, lim = map(int, readline().split())
WV = np.array(read().split(), np.int64)

W = WV[::2]
V = WV[1::2]

# weight -> value
dp = np.zeros(lim + 1, np.int64)
for w, v in zip(W, V):
    np.maximum(dp[w:], dp[:-w] + v, out=dp[w:])
print(dp.max())
# Judge status: Accepted
n = int(input())
c = input()
r = c.count('R')
print(c[:r].count('W'))
# Judge status: Wrong Answer
o, e = input(), input()

ans = ""
for q in range(min(len(o), len(e))):
    ans += o[q] + e[q]
if len(o) != len(e):
    ans += e[-1]
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
arr = list(map(int, input().split()))
i = k
j = 0
nxt = 0
pre = sum(arr[:k])
while i < len(arr):
    nxt = (pre + arr[i]) - arr[j]
    if nxt > pre:
        print('Yes')
    else:
        print('No')
    j += 1
    i += 1
    pre = nxt
# Judge status: Accepted
import os

def main():
    str_s,str_t = input().split()
    print(str_t + str_s)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
a=0
for i in range(n+1):
    if i*i <= n:
        a=i*i
    else:
        print(a)
        break
# Judge status: Accepted
a,b = map(int,input().split())
cnt = 0

for i in range(a,b+1):
    tmp = str(i)[::-1]
    if str(i) == tmp:
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
N=int(input())

m=N%11
ans=-(-N//11)*2

if m<=6:
    print(ans-1)
else:
    print(ans)
# Judge status: Accepted
h1, m1, h2, m2, k = map(int, input().split())
time1 = h1*60+m1
time2 = h2*60+m2
print(time2-time1-k)
# Judge status: Accepted
a,b,c,d=input()
if b==c and(a==b or c==d):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=0
while f<k:
    b=[0]*n
    for i in range(n):
        for j in range(i-a[i],i+a[i]+1):
            if 0<=j<=n-1:
                b[j]+=1
    a=b
    f+=1
print(a)
# Judge status: Accepted
w = input()
d = {}
for i in w:
    d.setdefault(i, [0])[0] += 1
for i, in d.values():
    if i % 2 != 0:
        print("No")
        break
else:
    print("Yes")
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print("Yes") if (a + b + c) // 2 == 0 else print("No")
# Judge status: Wrong Answer
n,k = map(int,input().split())

z = 0
l = [0]
for i in range(k):
  d=int(input())
  s =list(map(int,input().split()))
  l.extend(s)
  
print(l)
for i in range(n+1):
  if l.count(i)==0:
    z = z + 1
print(z)
# Judge status: Accepted
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
  if str(i)==str(i)[::-1]:
    ans+=1
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())

if a >= 13:
    print(b)
elif a >= 6:
    print(b // 2)
else:
    print(0)
# Judge status: Wrong Answer
n = int(input())
s = input() 
if s.count(s[:n//2]) == 2 and n != 1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import collections
n = int(input())
a = list(map(int,input().split()))

a_cnt = collections.Counter(a)
#print(a_cnt)
cnt = 0
for item in a_cnt.items():
    if item[0]<item[1]:
        cnt += item[1]-item[0]
    elif item[0]>item[1]:
        cnt += item[1]
print(cnt)
# Judge status: Accepted
Q, H, S, D = map(int, input().split())
N = int(input())
cheap_l = min(4*Q, 2*H, S)
print(min(N*cheap_l, (N//2)*D+(N%2)*cheap_l))
# Judge status: Wrong Answer
from fractions import math
a, b, x = map(int, input().split())
print(math.atan(a*(b**2)/2/x)/math.pi*180)
# Judge status: Accepted
def main2():
    n, k = list(map(int, input().split()))
    monsters = list(map(int, input().split()))
    monsters.sort(reverse=True)

    for i in range(k):
        if i >= len(monsters):
            break
        monsters[i] = 0
    print(sum(monsters))

if __name__ == '__main__':
    main2()
# Judge status: Wrong Answer
s = input()
point = 0

for i in s:
    if i in "ACGT":
        point += 1

print(point)
# Judge status: Wrong Answer
import numpy as np
import sys
input = sys.stdin.buffer.readline

N, M, K = map(int, input().split())
cumA = np.zeros(N+1, dtype=np.int32)
cumA[1:] = np.array(input().split(), dtype=np.int32).cumsum()
cumB = np.zeros(M+1, dtype=np.int32)
cumB[1:] = np.array(input().split(), dtype=np.int32).cumsum()
# print(cumA)
# print(cumB)

ans = 0
for i in range(N, -1, -1):
    if cumA[i] > K: continue
    j = np.searchsorted(cumB, K-cumA[i], side='right')
    ans = max(ans, i+j-1)
print(ans)
# Judge status: Wrong Answer
x = int(input())
if x != 1:
    print(0)
else:
    print(1)
# 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
N = int(input())
A = list(map(int, input().split()))

x = 0
for a in A:
    x ^= a

ans = []
for a in A:
    ans.append(x ^ a)

print(" ".join(map(str, ans)))
# Judge status: Accepted
N = int(input())
T = int(input())
ans = T
import math
for i in range(N - 1):
    T = int(input())
    ans = T * ans // math.gcd(T, ans)
print(ans)
# Judge status: Wrong Answer
S = input()
ans = 0
for i in range(len(S)):
    for j in range(i,len(S)):
        print(S[i:j+1])
        flag = True
        for k in S[i:j+1]:
            if not (k=='A' or k=='C' or k=='G' or k=='T'):
                flag = False
                break
        if flag:
            ans = max(ans, len(S[i:j+1]))
print(ans)
# Judge status: Accepted
n,a,b,c,d = map(int,input().split())
S = list(input())

flg = 1
for i in range(a-1,c-2):
    if S[i:i+2] == ['#','#']:
        flg *= 0

for i in range(b-1,d-2):
    if S[i:i+2] == ['#','#']:
        flg *= 0

if c>d:
    flg2 = 0
    for i in range(b-1,d):
        if S[i-1:i+2] == ['.','.','.']:
            flg2 = 1
    flg *= flg2

if flg == 0:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
N = int(input())
V = [_ for _ in map(int,input().split())]
v = len(V)
V.sort()
if v == 2:
    print(sum(V)/2)
else:
    i = 2
    X = (V[0] + V[1])/2
    while i != N:
        X = (X + V[i])/2
        i += 1
    print(X)
# Judge status: Accepted
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n <= k:
    print n * x
else:
    print k * x + (n - k) * y
# Judge status: Accepted
a,b,c = map(int,input().split())
k = int(input())
p = 0
while a >= b:
  b *= 2
  p += 1
while b >= c:
  c *= 2
  p += 1
if p <= k:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N, A, B = map(int, input().split())
count = 0
for i in range(1,N+1):
    n = list(k for k in str(i))
    S_n = 0
    for j in n:
        S_n += int(j)
    if A <= S_n <= B:
        count += i
print(count)
# Judge status: Accepted
K = int(input())
a = 7 % K
cnt = 1
while a:
    a = (10*a+7) % K
    cnt += 1
    if K < cnt:
        cnt = -1
        break
print(cnt)
# Judge status: Wrong Answer
a=int(input())
print('Yes' if 30>=a else 'No')
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))
D = list()
D.append(A[0] + K - A[-1])
for i in range(N - 1):
    D.append(A[i + 1]- A[i])

print(K - max(D))
# Judge status: Accepted
def main():
    h,n,*t=map(int,open(0).read().split())
    d=[0]+[10**18]*h
    for a,b in zip(*[iter(t)]*2):
        for j in range(h+1):
            k=j-a
            if k<0:k=0
            c=d[k]+b
            if c<d[j]:d[j]=c
    print(d[h])
main()
# Judge status: Accepted
n, k = map(int, input().split())
x = set()
for i in range(k):
    d = int(input())
    for j in input().split():
        x.add(j)

print(n - len(x))
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

print((II()+II())*II()//2)
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = list(map(int, input().split()))
D = []
result_m = 0
for m in range(M):
  B, C = map(int, input().split())
  D.extend([C]*B)
A.sort()
D.sort(reverse=True)
result = 0
for i in range(min(len(A),len(D))):
  if D[i]-A[i]<=0:
    break
  result+=1
print(result)
print(D[:result]+A[result:])
print(sum(D[:result])+sum(A[result:]))
# Judge status: Accepted
a, b, c = map(int, input().split())
print(c - (a-b) if c >= (a-b) else "0")
# Judge status: Wrong Answer
s = {'a': input(), 'b': input(), 'c': input()}

now = 'a'
while s[now] != '':
    now = s[now][0]
    s[now] = s[now][1:]
print(now.upper())
# Judge status: Wrong Answer
n = int(input())
A_list = list(map(int, input().split(" ")))
print(A_list)
for i in range(1, n+1):
    print(A_list.count(i))
# Judge status: Accepted
import math
N = int(input())
X_MAX = int(math.ceil(50000 / 1.08))

ans = ':('
for i in range(X_MAX + 1):
    if int(i * 1.08) == N:
        ans = i
        break

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

i = 0
ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
    s = input()
    if s == "AC":
        ac += 1
    elif s == "TLE":
        tle += 1
    elif s == "WA":
        wa += 1
    else:
        re += 1
    i += 1

print("AC x %s" %(ac))
print("WA x %s" %(wa))
print("TLE x %s" %(tle))
print("RE x %s" %(re))
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
s = input()
cnt = 0
memo = 0
for i in range(n):
  if s[i] == 'c':
    print('No')
  else:
    if cnt < a + b:
      cnt += 1
      if s[i] == 'b' and memo <= b:
        memo += 1
        print('Yes')
      elif s[i] == 'a':
        print('Yes')
      else:
        print('No')   
    else:
      print('No')
# Judge status: Wrong Answer
import collections

n=int(input())	
s=input()

c = collections.Counter(s)

ans_count = c['R'] * c['G'] * c['B']

for i in range((n-1)//2):
    for j in range(n):
        if j+(2*i) >= n:
            break

        if s[j] != s[j+i] and s[j+i] != s[j+(2*i)] and s[j] != s[j+(2*i)]:
            ans_count -= 1


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

x = n//2
if sum(a)/2 == sum(a[:(n//2)]):
  print(0)
elif sum(a)/2 >= sum(a[:(n//2)]):
  while sum(a)/2 >= sum(a[:x]):
    x += 1  
  print(min(abs(2*sum(a[:x])-sum(a)), abs(2*sum(a[:x-1])-sum(a))))
else:
  while sum(a)/2 <= sum(a[:x]):
    x -= 1
  print(min(abs(2*sum(a[:x])-sum(a)), abs(2*sum(a[:x+1])-sum(a))))
# Judge status: Wrong Answer
#C
def gcd(a, b):
    if b > a:
        a, b = b, a
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
        
K = int(input())
ans = 0
for a in range(1, K+1):
    for b in range(a+1, K+1):
        for c in range(b+1, K+1):
            tmp = gcd(a, b)
            ans += gcd(tmp, c)
print(ans)
# Judge status: Accepted
import sys
a, b, k = map(int, sys.stdin.readline().split())
if a < k:
  if a + b - k >= 0:
    print(0, a + b - k)
  else:
    print(0, 0)
else:
  print(a - k, b)
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(0,M):
    A[A.index(max(A))]=int(A[A.index(max(A))])

print(sum(A))
# Judge status: Wrong Answer

a,b,c=map(int,input().split())
if c-a > 0 and b-a < 0:
    print('Yes')
elif c-a < 0 and b-a > 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
from sys import stdin
import fractions

n = int(stdin.readline().rstrip())
li = [[0,0]]+[list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
li = li[::-1]
count = 0
for i in range(n):
    if li[i][0]%li[i][1] != 0:
        count += li[i][1]-li[i][0]%li[i][1]
        li[i+1][0] += count
print(count)
# Judge status: Accepted
a, b = (int(i) for i in input().split())
print(a * b)
# Judge status: Accepted
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
def md(x):
    u = sorted(x)
    if len(u) % 2 == 0:
        return u[len(u) // 2] + u[len(u) // 2 - 1]
    else:
        return u[len(u) // 2]
u, v = md(a), md(b)
print(v - u + 1)
# Judge status: Accepted
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
maxp = 0
for i in s:
    pre = s.count(i)-t.count(i)
    maxp = max(maxp,pre)
print(maxp)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
def gcd(a, b):
    return b if a == 0 else gcd(b % a, a)
l = [0]
r = [0]
for i in range(n):
    l.append(gcd(l[-1], a[i]))
    r.append(gcd(r[-1], a[n - i - 1]))
ret = 0
for i in range(n):
    ret = max(ret, gcd(l[i], r[n - i - 1]))
print(ret)
# Judge status: Accepted
n,k,s = map(int,input().split())
ans = []
for i in range(k):
  ans.append(str(s))
  
for j in range(n-k):
  if s != 1000000000:
    ans.append(str(s+1))
  else:
    ans.append(str(s-1))
print(' '.join(ans))
# Judge status: Wrong Answer
s = int(input())
print(0, 0, 0, 1, s, 0)
# Judge status: Accepted
n,m = map(int,input().split())
def f(x):
  d = []
  for i in range(1, int(x**0.5)+1):
    if x % i == 0:
      d.append(i)
      if i != x // i:
        d.append(x//i)
  d.sort(reverse = True)
  return d
for i in f(m):
  if m // i >= n:
    print(i)
    quit()
# Judge status: Wrong Answer
s = input()
if 'N' in s and 'W' in s and 'S' in s and 'E' in s:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

if K == 0:
    print(max(A))
    exit()

def f(x):
    cnt = 0
    for i in A:
        if i % x == 0:
            cnt += i//x - 1
        else:
            cnt += i//x
    
    if cnt <= K:
        return True
    else:
        return False


ok = 1
ng = 1e10
for i in range(60):
    mid = (ok + ng) // 2
    if f(mid):
        ng = mid
    else:
        ok = mid
print(ng)
# Judge status: Accepted
n,a,b = map(int, input().split())
if a>b:print(0);exit()
if n==1 and a!=b:print(0);exit()
print((b-a)*(n-2)+1)
# Judge status: Wrong Answer
n, d = map(int, input().split())
ans = (n+2*d)/(2*d+1)
print(ans)
# Judge status: Wrong Answer

N = int(input())
i = 1
while i < N:
    if((i * i) > N):
        print((i-1) * (i-1))
        break
    i += 1
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
count=0
for i in range(len(a)):
    if (i%2==1)&(a[i]%2==1):
        count+=1
print(count)
# Judge status: Wrong Answer
"""
abc141-b
"""

import sys

S = input()

if (len(S) == 1):
    print("No")
    sys.exit()
else:
    for i in range(int(len(S))-1):
        if (i % 2 == 0):
            if (S[i] == "L"):
                print("No")
                sys.exit()
        else:
            if (S[i] == "R"):
                print("No")
                sys.exit()

print("Yes")
# Judge status: Wrong Answer
n = int(input())
a = [int(_) for _ in input().split()]
left = [0] * (n//2)
right = [0] * (n//2)
if n % 2 == 0:
    left = a[n:0:-2]
    right = a[0:n:2]
    ans = left + right
else:
    left  = a[n:1:-2]
    right = a[1:n:2]
    ans = left + [a[0]] + right
print(ans)
# Judge status: Accepted
D=int(input())
if D==22:
    print("Christmas Eve Eve Eve")
elif D==23:
    print("Christmas Eve Eve")
elif D==24:
    print("Christmas Eve")
elif D==25:
    print("Christmas")
# Judge status: Accepted
S = input()
Q = int(input())

r = False
prefix = []
suffix = []
for _ in range(Q):
    query = input()
    if query == '1':
        r ^= True
    else:
        _, f, c = query.split()
        front = f == '1'

        if r ^ front:
            prefix.append(c)
        else:
            suffix.append(c)

if r:
    S = ''.join(suffix[::-1]) + S[::-1] + ''.join(prefix)
else:
    S = ''.join(prefix[::-1]) + S + ''.join(suffix)

print(S)
# Judge status: Wrong Answer
n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]

sorted(ab, key = lambda x:x[1])

ans = 0
for i in ab:
    ans+=i[0]
    if ans > i[1]:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
from math import ceil, log

def main():
    n = int(input())
    if n == 0:
        print(0)
        return
    k = 2 * int(log(3 * n, 4)) + 1 if n > 0 else 2 * ceil(log((2 - 3 * n) // 2, 4))
    s = [0] * k
    while n:
        k = 2 * int(log(3 * n, 4)) if n > 0 else 2 * ceil(log((2 - 3 * n) // 2, 4)) - 1
        s[k] = 1
        n -= (-2)**k
    print(*s[::-1], sep="")

if __name__ == '__main__':
    main()
# Judge status: Accepted
s = list(input().split())
a = list(map(int, input().split()))
t = input()
a[s.index(t)] -= 1
print(*a)
# Judge status: Wrong Answer
K = int(input())
print(K ** 3 + (1 / 2) *K ** 2 - (1 / 2) * K)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
d={}
ua=list(set(a))
total=0
print('hoge')
for x in ua:
    y=a.count(x)
    d[x]=y
    total+=(y-1)*y//2
for x in a:
    print(total-d[x]+1)
# Judge status: Wrong Answer
from operator import itemgetter

n = int(input())
 
# data = [input().split() for _ in range(n)]
data = []
for i in range(n):
    city, point = input().split()
    data.append([city, point, i+1])

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

for i in range(n):
    print(data[i][2])
# Judge status: Accepted
a, b, c = map(int, input().split())

if a == b + c or b == c + a or c == a + b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import math
f=math.factorial
n,m=map(int,input().split())
print(f(n)*f(m)*(1+(n==m))%(10**9+7) if abs(n-m)<2 else 0)
# Judge status: Wrong Answer
def main():
    N = int(input())
    ANS = []
    while N > 0:
        ANS.insert(0,chr(N%26+96))
        N = N//26
    print(''.join(ANS))


if __name__ == '__main__':
    main()