peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n,m = map(int, input().split())
s=[]
for i in range(m):
  s.append(list(map(int, input().split())))

for i in range(1000):
  if len(str(i)) != n:
    continue
  for si in s:
    if len(str(i)) < si[0]:
      break
    if str(i)[si[0]-1] != str(si[1]):
      break
  else:
    print(i)
    break
else:
  print(-1)
# Judge status: Accepted
n = int(input())
a  = [int(_) for _ in input().split()]
aa = [abs(_) for _ in a]

ans = 0
cnt = 0
for i in a:
    if i < 0:
        cnt += 1
    ans += abs(i)
if cnt % 2 == 0:
    print(ans)
else:
    ans -= abs(min(aa)) * 2
    print(ans)
# Judge status: Accepted
a, b, x = map(int, input().split())
print('YES' if a <= x <= a + b else 'NO')
# Judge status: Accepted
h = int(input())
ans = 0
count = 1
while h >= 1:
    h/=2
    ans += count
    count*=2
print(ans)
#print(count)
#if(ans==1099511627775):
#     print('T')
# Judge status: Accepted
s = int(input())
x = []
while True:
	d = s % 10
	x.append(d)
	s //= 10
	if s == 0:
		break
n = len(x)
m = 10000
for i in range(n-2):
	y = abs((x[n-1-i] - 7) * 100 + (x[n-1-i-1] - 5) * 10 + x[n-1-i-2] - 3)
	if y < m:
		m = y
print(m)
# Judge status: Accepted
*s, t = map(int, input().split())
s.sort()
f = False
for i in range(s[0],s[1]+1):
  if i == t:
    f = True
print("Yes") if f else print("No")
# Judge status: Wrong Answer
N = int(input())
T = [int(input()) for i in range(N)]
max_T = max(T)
i = 1
while 1:
    flg = 0
    for t in T:
        if max_T % t:
            flg = 1#割り切れなかったらフラグを立てる
    if not flg:
        print(max_T)
        exit()
    i += 1
    max_T *= i
# Judge status: Accepted
n = int(input())
s = input()

l = 0
r = 0
for si in s:
    if si == "(":
        l  += 1
    else:
        if l == 0:
            r += 1
        else:
            l -= 1

print("("*r + s + ")"*l)
# Judge status: Accepted
W,H,x,y = map(float,input().split())
if W/2 == x and H/2 == y:
    print(W*H/2,1)
else:
    print(W*H/2,0)
# Judge status: Accepted
s, k = input(), int(input())

ans = []
a = ord('z') + 1
for i in s:
    if k == 0:
        ans.append(ord(i))
    elif a - ord(i) <= k and i != 'a':
        k -= a - ord(i)
        ans.append(ord('a'))
    else:
        ans.append(ord(i))
ans[-1] += k % 26
if ans[-1] >= a:
    ans[-1] -= 26
print(*map(chr, ans), sep='')
# Judge status: Wrong Answer
N = list(map(int,input().split()))
M = (N[2] - N[1]) * (N[0] - 2) + 1
if N[0] == 1:
    print(0)
elif N[0] == 2:
    print(1)
elif N[1] > N[2]:
    print(0)
else:
    print(M)
# Judge status: Wrong Answer
n=int(input())
ans=n%9
if n!=0 and (ans==0 or ans==9):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import math
n=int(input())
l=[int(input()) for i in range(5)]
sum=0
w=n
for i in range(4):
  c=math.ceil((w/l[i]))
  sum+=c
  w=w-(c-1)*l[i+1]+w%l[i]
  if w==0:
    w=l[i]
print(sum+math.ceil(w/l[4]))
# Judge status: Accepted
w, h, x, y = map(int, input().split())

a = w*h/2

if w/2 == x and h/2 == y:
    b = 1
else:
    b = 0
print(a,b)
# Judge status: Wrong Answer
s = int(input())
lis = [s]

def func(n):
    if n%2 == 0:
        return n//2
    else:
        return 3*n+1
 
while func(s) !=1:
    s = func(s)
    lis.append(s)
    
print(len(lis)+2)
# Judge status: Accepted
import math
A, B, N = list(map(int, input().split()))
if B-1 >= N:
  num = N
else:
  num = B-1
  
print(math.floor(A*num/B)-A*math.floor(num/B))
# Judge status: Wrong Answer
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    A.sort()
    B.sort()
    D = [b-a for a, b in zip(A, B)]
    D_p = sum(d for d in D if d > 0)
    D_n = sum(-d for d in D if d < 0)
    print("Yes" if D_p >= 2*D_n else "No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
n,k = map(int,input().split())
s = list(input())
s[k-1] = s[k-1].lower()
print(''.join(s))
# Judge status: Accepted
# coding: utf-8
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
A=[0]*M
dp=[-1]*(N+1)
for i in range(M):
    tmp=int(input())
    dp[tmp]=0
#print(dp)
dp[0]=1
dp[1]=0 if dp[1]==0 else 1

for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=dp[i-1]+dp[i-2]
        
print(dp[N]%(10**9+7))
# Judge status: Accepted
w,a,b = map(int,input().split())
if a <= b <= a+w or b <= a <= b+w:
    print(0)
elif a < b:
    print(b-a-w)
else:
    print(a - b - w)
# Judge status: Accepted
x, y = map(int, input().split())
ans = 1
n = x
while n * 2 <= y:
    ans += 1
    n *= 2
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
ans = 0
while n != 0:
  n = int(n / k)
  ans += 1
print(ans)
# Judge status: Wrong Answer
s_17 = list(input())
# print(s_17)
s_17[3] = 8
print(*s_17)
# Judge status: Wrong Answer
n = int(input())
lst = []

while (n!=0):
    r = int(n%2)
    if(r<0):
        r += 2
    lst.append(r)
    n = (n-r)/(-2)

for i in range(len(lst)):
    print(lst[-1-i],end="")
print()
# Judge status: Wrong Answer
N = int(input())

ans = 'No'
X = N % 4
Y = N % 7
if X % 7 == 0 or Y % 4 == 0:
    ans = 'Yes'

print(ans)
# Judge status: Wrong Answer
s, w = map(int, input().split())

if s >= w:
  print('safe')
else:
  print('unsafe')
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
import math

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

N, K = MI()
mylist = LI()
length = len(mylist)

high = max(mylist)+1
low = 0
mid = (high + low) / 2

while high - low >= 0.001:
    temp = 0
    for i in mylist:
        if i % mid == 0:
            temp += (i // mid) - 1 
        else:
            temp += i // mid
    if temp > K:
        low = mid
    else:
        high = mid
    mid = (high + low) / 2


print(math.ceil(low))
# Judge status: Accepted
l = []
for i in range(5):
  x = input()
  l.append([int(x[-1]), int(x)])

l.sort()

ans = 0
flag = True
for l1, l2 in l:
  if l1 == 0:
    ans += l2
  elif flag:
    ans += l2
    flag = False
  else:
    ans += ((l2//10) + 1) * 10

print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    idx = 1
    cnt = 0
    for i in range(N):
        if A[i] == idx:
            idx += 1
            cnt += 1
    if cnt == 0:
        print(-1)
    else:
        print(N-cnt)
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N, A, B = list(map(int, input().split()))
res = 0
for i in range(N+1):
  if A <= sum([int(s) for s in str(i)]) <=B:
    res += 1
print(res)
# Judge status: Accepted
# B - Stone Monument
a, b = map(int, input().split())
diff = b - a

height = (1 + diff) * diff // 2

print(height - b)
# Judge status: Accepted
X,Y,A,B,C = map(int, input().split())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]

P.sort(reverse = True)
Q.sort(reverse = True)
R.sort(reverse = True)

PQ = P[:X] + Q[:Y]

PQ.sort()

for i in range(min(X+Y, C)):
    if PQ[i] < R[i]:
        PQ[i] = R[i]

print(sum(PQ))
# Judge status: Accepted
N,M = map(int,input().split())
I = set()
n = set()
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        I.add(b)
    if b == N:
        n.add(a)
if  I & n == set():
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
# Judge status: Wrong Answer
a = input()
if 'a'< a[0] :
    print("A")
else:
    print("a")
# Judge status: Accepted
a,b,c=map(int,input().split())
if a>c>b or a<c<b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,m=map(int,input().split())
lst=[list(map(int,input().split())) for i in range(n)]
lst.sort(key=lambda x:x[0])
ans=0
for i in lst:
  ans+=min(m,i[1])*i[0]
  m-=i[1]
  if m<=0:
    break
print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    print(n*(n-1)//2)

if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c,=map(int,input().split())
k=int(input())
while k>0:
    if max(a,b,c)==c:
        c=2*c
        k-=1
    elif max(a,b,c)==b:
        b=2*b
        k-=1
    else:
        a=2*a
        k-=1
print(sum([a,b,c]))
# Judge status: Accepted
a, b, k = map(int, input().split())

for x in range(a, min(b+1, a+k)):
    print(x)

for x in range(max(a+k, b-k+1), b+1):
    print(x)
# Judge status: Accepted
n,m = map(int,input().split())
a = list(map(int,input().split()))
l = [list(map(int,input().split())) for i in range(m)]
l = list(sorted(l,reverse=True,key=lambda x: x[1]))
b,c = [list(i) for i in zip(*l)]
d = [0] * n
x = min(n,sum(b))
y = 0
while x > 0:
    x -= 1
    d[x] = c[y]
    b[y] -= 1
    if b[y] == 0:
        y += 1
x = a + d
x.sort(reverse=True)
print(sum(x[:n]))
# Judge status: Accepted
c1 = input()
c2 = input()
if (c1 == c2[::-1]) and (c2 == c1[::-1]):
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n = int(input())
b = list(map(int,input().split()))
ANS = []
ANS.append(b[0])
for i in range(1, n - 1):
    ANS.append(min(b[i - 1], b[i]))

ANS.append(b[n-2])
print(sum(ANS))
# Judge status: Accepted
def main():
    q, h, s, d = map(int, input().split())
    n = int(input())
    min_1 = min(q*4, h*2, q*2+h, s)
    min_2 = min(min_1*2, d)

    print((n % 2)*min_1 + (n // 2)*min_2)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b,k = map(int,input().split())
i = 100
j = 0
while True:
    i -= 1
    if a % i == 0 and b % i == 0:
        j += 1
        if j == k:
            print(i)
            break
# Judge status: Accepted
a, b, k = list(map(int, input().split()))
la = []
lb = []
for i in range(1, a+1):
    if a % i == 0:
        la.append(i)
        sa = set(la)
        lsa = list(sa)
        lsas = sorted(lsa)
        for j in lsas:
            if b % j == 0:
                lb.append(j)
s = set(lb)
lsb = list(s)
lsbs = sorted(lsb)
print(lsbs[len(lsbs)-k])
# Judge status: Accepted
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans1 = []
ans2 = []

for x in range(N):
    if x == 0:
        ans1.append(A1[x])
        ans2.append(A1[x] + A2[x])
    else:
        ans1.append(ans1[x - 1] + A1[x])
        ans2.append(max(ans1[x], ans2[x - 1]) + A2[x])
print(ans2[N - 1])
# Judge status: Accepted
s=int(input())
if s==1 or s==2:
  print(4)
else:
  i=1
  while s!=1:
    i+=1
    if s%2==0:
      s/=2
    else:
      s=s*3+1
  print(i+1)
# Judge status: Accepted
#!python3

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


def main():
    s = N - K
    k = K - 1
    ans = 1
    ans += s // k
    if s % k != 0:
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s = str(input())
Alst = []
Zlst = []
for i in range(len(s)):
    if s[i]=='A':
        Alst.append(i)
    elif s[i]=='Z':
        Zlst.append(i)
print(max(Zlst)-min(Alst))
# Judge status: Accepted
a,b=map(str,input().split())
print(b+a)
# Judge status: Accepted
n,x,y = map(int,input().split())
x -= 1
y -= 1
cnt = [0]*n
for i in range(n):
    for j in range(i+1,n):
        d = min(j-i,abs(x-i)+1+abs(j-y))
        #print(d,end=' ')
        cnt[d] += 1
for i in range(1,n):
    print(cnt[i])
# Judge status: Accepted
s = input()

if s.count('S') == 0:
    print(3)
elif s[:2] == 'RR' or s[1:3] == 'RR':
    print(2)
elif s[0] == 'R' and s[2] == 'R':
    print(1)
elif s.count('R') == 1:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
n, m = map(int, input().split())
numbers = [0]*n
existence = False



for _ in range(m):
    s, c = map(int, input().split())
    if c > numbers[s-1]:
        numbers[s-1] = c
    if s == 1:
        if c != 0 or n == 1:
            existence = True

if existence:
    print(*numbers, sep='')
else:
    print(-1)
# Judge status: Wrong Answer
s = input()
count, final = 0, 0
for i in s:
    if i == "R": count += 1
    elif i == "S":
        if count > final: final, count = count, 0
print(final)
# Judge status: Accepted
A, B = [int(i) for i in input().split()]

if A <= 8 and B <= 8:
    print('Yay!')
else :
    print(':(')
# Judge status: Accepted
s = input()
N = len(s)
f = s[0]
c = 0
for i in range(1,N):
  if i % 2 == 1:
    if f == s[i]:
      c+=1
  else:
    if f != s[i]:
      c+=1
print(c)
# Judge status: Accepted
L,R,d = map(int,input().split())

ans = 0
for i in range(L,R+1):
  if i % d == 0:
    ans += 1
    
print(ans)
# Judge status: Accepted
l, r = map(int, input().split())
x = l % 2019
y = r % 2019
if x > y:
    y += 2019
ans = 10 ** 7
for i in range(x, y + 1):
    for j in range(x, y + 1):
        if ans > (i * j) % 2019 and i != j:
            ans = (i * j) % 2019
if l + 2019 < r:
    ans = 0
print(ans)
# Judge status: Accepted
s = list(input())
k = int(input())
n = len(s)
alph_map = {chr(ord('a') + i): (26 - i) % 26 for i in range(26)}
for i in range(n):
    if k >= alph_map[s[i]]:
        k -= alph_map[s[i]]
        s[i] = 'a'
if k > 0:
    s[n-1] = chr((ord(s[n-1]) + k % 26) % 123)
print(''.join(s))
# Judge status: Accepted
s = input()
a = s.count('a')
b = s.count('b')
c = s.count('c')

if abs(a-b)<=1 and abs(b-c)<=1 and abs(c-a)<=1:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
K = int(input())
F = set()
val = 7
flg = True
for i in range(K+6):
  if val % K == 0:
    flg = False
    print(i+1)
    break
  F.add(val%K)
  val *= 10
  val += 7
  val %= K
  if val % K in F:
    break
if flg:
  print(-1)
# Judge status: Wrong Answer
def main():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    S = [list(map(int, input(_).split())) for _ in range(M)]
    #LIST = [1] * N
    LIST = [ 1 for _ in range(N)]
    for A, B in S:
        if H[A-1] >= H[B-1]: LIST[B-1] = 0
        if H[A-1] <= H[B-1]: LIST[A-1] = 0
#        if H[A-1] == H[B-1]:
#            LIST[B - 1] = 0
#            LIST[A - 1] = 0
    print(sum(LIST))

main()
# Judge status: Accepted
H, N = [int(x) for x in input().strip().split()]
print('YNeos'[sum([int(x) for x in input().split()])<H::2])
# Judge status: Accepted
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if a<b:
    a+=v*t
    b+=w*t
    if a<b:
        print("NO")
    else:
        print("YES")
else:
    a-=v*t
    b-=w*t
    if a>b:
        print("NO")
    else:
        print("YES")
# Judge status: Wrong Answer
N = int(input())
A = [[int(i) for i in input().split()] for j in range(2)]
count = 0
Max = 0

for i in range(N):
    for j in range(i+1):
        count += A[0][j]
    for j in range(N-i-1):
        count += A[1][i+j]
    Max = max(Max, count)

print(Max)
# Judge status: Wrong Answer
H,A = map(int,input().split())
print(H // A + 1)
# Judge status: Wrong Answer
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    ans = 0
    mod = 10 ** 9 + 7
    for d in range(59):
        # d桁目ごとに考える
        x = 0
        for a in A:
            if (a >> d) & 1:
                x += 1
        ans += x * (n-x) * 2**d
        ans %= mod
    print(ans)
 
if __name__ == '__main__':
    main()
# Judge status: Accepted
k, x = map(int, input().split())
if k * 500 >= x:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s=input()
ls = len(s)
k= int(input())
for i in range(ls-1):
    tn = ord('z')-ord(s[i])+1
    if k>=tn:
        k-=tn
        print('a',end='')
    else:
        print(s[i],end='')
ik = (k + ord(s[-1])-ord('a')) % 26
print(chr(ord('a')+ik))
# Judge status: Accepted
import sys
input = sys.stdin.readline
n,m = map(int, input().split())
a = set(map(int, [input() for _ in range(m)]))
dp = [0] * (n+1)

#`dp[i] = i段目にいる通り数`
if not 0 in a:
    dp[0] = 1
if not 1 in a:
    dp[1] = 1
    
for i in range(2,n+1):
    if i in a:
        dp[i] = 0
    else: 
        dp[i] += (dp[i-1] + dp[i-2]) % (10 ** 9 + 7)

print(dp[-1])
# Judge status: Wrong Answer
S = input()
N = len(S)
print(N)
cnt = 0

for i in range(N):
    for j in range(i+4, N+1):
        if int(S[i:j]) % 2019 == 0:
            cnt += 1
print(cnt)
# Judge status: Accepted
from sys import stdin
n = int(stdin.readline().rstrip())
point = 0
for i in range(1,n+1):
    point += i
    if point >= n:
        sa = point-n
        for k in [j for j in range(1,i+1) if j != sa]:print(k)
        break
# Judge status: Accepted
N = int(input())
A = [0]+list(map(int, input().split()))
ans = 0
tree = []
presum = 0
for i, elt in enumerate(A[:0:-1]):
    presum += elt
    tree += presum,
vertices = []
last = .5
for i,elt in enumerate(tree[::-1]):
    last = min(2*(last-A[i]), elt)
    ans += int(last)
    if last <= 0:
        break
if last > 0 and last == A[-1]:
    print(ans)
else:
    print(-1)
# Judge status: Wrong Answer
S = input()
count = 0

leng = len(S)


        
for i in range(0,int(leng/2)):
    if(S[i] != S[leng-i-1]):
        print(S[i])
        count+=1
    
print("%d"%(count))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans=float("inf")
for i in range(-100,100):
    k=0
    for j in a:
        k+=(j-i)**2
    ans=min(ans,k)
print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[list(map(int,input().split())) for a in range(n)]
c=[list(map(int,input().split())) for b in range(m)]
dist=0
minnum=0
for indi,i in enumerate(a):
    dist=0
    min=10*14
    for indj,j in enumerate(c):
        dist+=abs(i[0]-j[0])
        dist+=abs(i[1]-j[1])
        if min>dist:
            min=dist
            minnum=indj
        dist=0 
    print(minnum+1)
# Judge status: Wrong Answer

a = list(map(int,input().split()))
k = int(input())
a[-1] = a[-1] * (2**k)

print(sum(a))
# Judge status: Accepted
c,a,b = map(int, input().split())
print(int(a*c/2))
# Judge status: Accepted
n = int(input())
numlist = [1,2,3,4,5,6,7,8,9]
flag = False

for i in numlist:
  ans1 = n / i
  for j in numlist:
    ans2 = ans1 / j
    if ans2 == 1:
      flag = True
      
if flag:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def resolve():
    K,A,B = map(int,input().split())
    if A>=B or K<=A:
        print(K+1)
        return
    
    nokori = K-A+1
    diff = B-A

    sc = A+ + diff*(nokori//2) +(1 if nokori%2 ==1 else 0)
    print(max(sc,K+1))
resolve()
# Judge status: Accepted
N=int(input())
S=[]
for _ in range(N):
    s=input()
    S.append("".join(sorted(s)))
    #S.append(sorted(s))
#print(S)
re=0
dt={}
for i in range(N):
    if S[i] in dt:
        dt[S[i]]+=1
    else:
        dt[S[i]]=1
for v in dt.values():
    if v>=2:
        v-=1
        re+=(v*(v+1)//2)

print(re)
# Judge status: Accepted
s = input()
print(s.replace(s[3], '8', 1))
# Judge status: Wrong Answer
import numpy as np 
n=int(input())
a=np.array(list(map(int, input().split())))
sum=0
for i in range(60):
  x= np.count_nonzero(a>>i & 1)
  sum+=x*(n-x)<<i
print(int(sum%(1e9+7)))
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
d = int(readline())

if d == 22:
    print('Christmas Eve Eve Eve')
elif d == 23:
    print('Christmas Eve Eve')
elif d == 24:
    print('Christmas Eve')
else:
    print('Christmas')
# Judge status: Accepted
a, b, c = map(int, input().split())

tmp = []
x = a
i = 1
while x % b != 0:
    x = a * i
    tmp.append(x % b)
    i += 1

if c in tmp:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
s = input()
# 0, 2, 4, ..., 2n 番目がeven_position
even_position_nums = s[::2]
len_even = len(even_position_nums)
odd_position_nums = s[1::2]
len_odd = len(odd_position_nums)

# 辞書のほうが計算量的に良い（毎度O(n)かかっている）
# evenを0、oddを1にする
tmp = len_even - even_position_nums.count('1')
tmp1 = len_odd - odd_position_nums.count('0')
first = tmp + tmp1
# evenを1、oddを0にする
tmp = len_even - even_position_nums.count('0')
tmp1 = len_odd - odd_position_nums.count('1')
second = tmp + tmp1
print(min(first, second))
# Judge status: Accepted
n,m = map(int,input().split())
p = {str(i):[] for i in range(1,n+1)}
l = []
for i in range(m):
    t = input().split()
    l.append((t[0],int(t[1])))
    p[t[0]].append(int(t[1]))
for i in range(1,n+1):
    i = str(i)
    p[i].sort()
    d = {}
    for j in range(len(p[i])):
        d[p[i][j]] = str(i).zfill(6)+str(j+1).zfill(6)
    p[i]=d
for t in l:
    print(p[t[0]][t[1]])
# Judge status: Accepted
from typing import List


def answer(n: int, l: int, s: List[str]) -> str:
    return ''.join(sorted(s))


def main():
    n, l = map(int, input().split())
    s = [input() for _ in range(n)]
    print(answer(n, l, s))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=int(input())

k=1
while n>k:
  k=k*2
  
print(k)
# Judge status: Accepted
#n=int(input())
n,d=map(int,input().split())
#l=list(map(int,input().split()))
xl=[list(map(int,input().split())) for i in range(n)]

ans=0
import math
for i in range(n):
    for j in range(n):
        if i>=j:
	        continue
        total=0
        for k in range(d):
            total+=(xl[i][k]-xl[j][k])**2
        total=math.sqrt(total)
        if total==int(total):
            ans+=1
print(ans)
# Judge status: Accepted
n, k =map(int, input().split())
p = list(map(int, input().split()))
lista = [(i + 1) / 2 for i in p]
listb = [0]
ans = 0
for i in range(n):
    listb.append(lista[i] + listb[i])
for i in range(n - k + 1):
    ans = max(ans, listb[i + k] - listb[i])
print(ans)
# Judge status: Wrong Answer
alphabet = 'abcdefghijklmnopqrstuvwxyz'
s = input()
K = int(input())
ans = ''
for i in range(len(s) - 1):
    s_i = alphabet.index(s[i])
    if 26 - s_i < K:
        K -= 26 - s_i
        s_i = 0
    ans += alphabet[s_i]
s_i = (alphabet.index(s[-1]) + K) % 26
ans += alphabet[s_i]
print(ans)
# Judge status: Wrong Answer
S = input()
N = len(S)

pre = S[0 : int((N-1)/2)]
print(pre)
bck = S[int((N+1)/2) : N]
print(bck)

if S == S[::-1] and pre == pre[::-1] and bck == bck[::-1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N,M = map(int,input().split())
if N == 1:
    print(M-2)
else:
    print((N-2)*(M-2))
# Judge status: Accepted
a=input()
a=str(a)
b=a[len(a)-1]
if b=='2' or b=='4' or b=='5' or b=='7' or b=='9':
    print('hon')
elif b=='0' or b=='1' or b=='6' or b=='8':
    print('pon')
else:
    print('bon')
# Judge status: Wrong Answer
s=input()
k=int(input())

if k==1:
    print(int(s[0]))

elif int(s[0])==1:
    num=1
    for i in range(1, len(s)):
        if int(s[i])!=1:
            num=int(s[i])
            break

    print(num)
elif int(s[0])!=1:
    print(int(s[0]))
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))

L2 = list(set(L)) # 重複を削除

ans = 0

for i in range(len(L2)):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)
# Judge status: Accepted
X,K,D=map(int,input().split())
Y=X%D
if abs(X)-K*D>0:
    ans=abs(X)-K*D
else:
    Z=(K-abs(Y-X)//D)%2
    if Z==0:
        ans=Y
    else:
        ans=Y-D
print(abs(ans))
# Judge status: Accepted
n,a,b = list(map(int, input().split()))
if abs(b-a)%2==0:
    print(abs(b-a)//2)
else:
    #卓1に行くコスト
    c1=max(a,b)-1
    #卓Nに行くコスト
    c2=n-min(a,b)
    
    ans=0
    cost=min(c1,c2)
    if c1<c2:
        ans+=min(a,b)-1
    else:
        ans+=n-max(a,b)
    cost-=ans
    ans+=(cost+1)//2
    print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

n = int(input())
cnt = 0
ans = []
for i in range(1, n + 1):
    cnt += i
    ans.append(i)
    if cnt >= n:
        if cnt > n:
            ans.remove(cnt - n)
        for j in range(len(ans)):
            print(ans[j])
        exit()
# Judge status: Accepted
import sys
import bisect
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
ls = [i * 400 - 1 for i in range(1, 9)]
_set = set()
n_max = 0
for a in a_ls:
    ind = bisect.bisect_left(ls ,a)
    if ind == 8:
        n_max += 1
    else:
        _set.add(ind)
_min = len(_set) if len(_set) > 0 else len(_set) + (n_max > 0)
print(_min, len(_set) + n_max)
# Judge status: Accepted
#!/usr/bin/env python3
import sys


def solve(L: int):
    print(L*L*L/27)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    solve(L)

if __name__ == '__main__':
    main()