peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n = int(input())

num = 100
i = 0
while num <=n:
    num = num*101//100
    i +=1
print(i)
# Judge status: Accepted
n=int(input())
a=[[int(i) for i in input().split()] for i in range(n)]
a=sorted(a,key=lambda x:(x[1]))
#print(a)

time=0
for i in a:
    time+=i[0]
    if time>i[1]:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
n = int(input())
s = list()

for a in range(n):
    s.append(input())

t = list()
m = int(input())

for a in range(m):
    t.append(input())

kind = list(set(s))
kind_length = len(kind)

counter = dict()
for a in range(kind_length):
    counter[kind[a]] = 0

for a in range(n):
    counter[s[a]] += 1

for a in range(m):
    if t[a] not in counter:
        continue
    counter[t[a]] -= 1

print(max(max(counter.values()), 0))
# Judge status: Accepted
s=input()
ans="NO"
t="keyence"
for i in range(8):
    if s[:i]==t[:i] and s[len(s)-7+i:]==t[i:]:
        ans="YES"
        break
print(ans)
# Judge status: Wrong Answer
N=[int(e) for e in input().split()]
if N[1]==0:
    A=0
else:
    M=N[0]//(N[1]+N[2])
    if M==0:
        if N[0]>N[1]:
            A=N[1]
        else:
            A=N[0]
    else:
        A=M*N[1]+N[0]%(N[1]+N[2])
print(A)
# Judge status: Accepted
A,B,K = map(int,input().split())

X = A-K
if(X >= 0):
  A=X
  print(A,B)
  
elif(X < 0 ):
  A=0
  if(B+X>=0):
    B=B+X
    print(A,B)
  elif(B+X<0):
    print(0,0)
# Judge status: Accepted
n=sorted([int(input()) for _ in range(int(input()))]);r,a=sum(n),0
if r%10==0:
  for i in n:
    if (r-i)%10!=0: a=max(a,r-i)
  print(a)
else:
  print(r)
# Judge status: Wrong Answer
import math
x = int(input())
if x <= 11:
    count = 0
    point = 0
    while True:
        point += 6
        count += 1
        if point >= x:
            break
        point += 5
        count += 1
        if point >= x:
            break
    print(count)
else:
    count = math.ceil(x/11*2)
    if count%2 != 0:
        minus = 6
    else:
        minus = 5
    if math.ceil(x/11*2) - minus >= x:
        count -= 1
    print(count)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(0,n,2):
    if a[i]%2 != 0:
        ans += 1
print(ans)
# Judge status: Accepted
if int(input()) in [3, 5, 7]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N = input()
print("Yes" if '7' in N else "No")
# Judge status: Accepted
#n=int(input())
a,b,k=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
l=[]
for i in range(1,min(a,b)+1):
    if a%i==0 and b%i==0:
        l.append(i)

l.sort(reverse=True)

print(l[k-1])
# Judge status: Wrong Answer
def check():
    N,M = map(int, input().split())
    hune = sorted([list(map(int, input().split())) for _ in range(M)], key=lambda x:x[0])
    print(hune)
    for a,b in hune:
        if a == 1:
            for c,d in hune:
                if c == b and d == N:
                    print('POSSIBLE')
                    return
        if a == 2:
            break
    print('IMPOSSIBLE')
check()
# Judge status: Wrong Answer
n, m = map(int, input().split(" "))
print((n*n-1+m*m-1)/2)
# Judge status: Accepted
N, T = map(int, input().split())
lists = [list(map(int, input().split())) for i in range(N)]

cost = 1001
count = 0
for i in range(N):
    if lists[i][1] <= T:
        count += 1
        if i == 0:
            cost = lists[i][0]
        elif cost >= lists[i][0]:
            cost = lists[i][0]
        else:
            continue
    else:
        continue
if count == 0:
    print("TLE")
else:
    print(cost)
# Judge status: Wrong Answer
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

h = int(readline())
cnt = 0
for i in range(h):
    if h < 2 ** i:
        print(cnt)
        exit()
    else:
        cnt += 2 ** i
# Judge status: Accepted
a,b,c=map(int, input().split())

print(int(a*b/2))
# Judge status: Wrong Answer
N = int(input())
print((N - 1) * N / 2)
# Judge status: Accepted
N, K= map(int, input().split())
h = list(map(int, input().split()))
DP = [float('inf')]*N
DP[0] = 0
for i in range(N-1):
  L = N-1-i
  for j in range(min(K,L)):
    DP[i+j+1] = min(DP[i+j+1], DP[i] + abs(h[i+j+1] - h[i]))  
print(DP[-1])
# Judge status: Accepted
import sys
N = int(input())
A = list(map(int, input().split()))
C = []
t = 0
for i in range(N, -1, -1):
    t += A[i]
    C.append(t)
C = C[::-1]

zanki = 1
ans = 1
for i in range(N+1):
    zanki -= A[i]
    if zanki < 0:
        print(-1)
        sys.exit()
    if zanki == 0 and i != N:
        print(-1)
        sys.exit()
    zanki *= 2
    if i < N and zanki >= C[i+1]:
        zanki = C[i+1]
    ans += zanki
print(ans)
# Judge status: Accepted
a,b,t = map(int,input().split())

n = (t+0.5)//a
print(int(n*b))
# Judge status: Accepted
import fractions
a, b = map(int, input().split())
print(a*b//fractions.gcd(a, b))
# Judge status: Accepted
S = input()
s01 = int(S[0]+S[1])
s23 = int(S[2]+S[3])
if (0 < s01 and s01 <= 12) and (0 < s23 and s23 <= 12):
    print('AMBIGUOUS')

elif (0 < s01 and s01 <= 12) and (s23 > 12 or s23 == 0):
    print('MMYY')

elif (s01 > 12 or s01 == 0) and (0 < s23 and s23 <= 12):
    print('YYMM')
else:
    print('NA')
# Judge status: Wrong Answer
import sys
s=list(input())
odd=["R","U","D"]
even=["L","U","D"]
for i in range(len(s)):
  if i%2==0:
    if s[i] not in even:
      print("No")
  else:
    if s[i] not in odd:
      print("No")
print("Yes")
# Judge status: Wrong Answer
s = str(input())
result = ""


for i in range(len(s)):
    if s[i] == "0":
        result += "0"
    elif s[i] == "1":
        result += "1"
    else:
        if len(result) > 0:
            result = result[0:i-1]

print(result)
# Judge status: Wrong Answer
n=input()
x=list(map(int,input().split()))
ans=0
for i in x[0::2]:
    if i%2==1:
        ans+=1
        print(i)
print(ans)
# Judge status: Wrong Answer
#B
import sys
n = int(input())
p = list(map(int, input().split()))
count=0
for i in range(n):
    if p[i] != i+1:
        if count == 2:
            print('No')
            sys.exit()
        else:
            count += 1
print('Yes')
# Judge status: Accepted
s = []
a = [0, 0, 0]
b = [0, 0, 0]
for i in range(3):
    s.append(list(map(int, input().split())))

b[0] = s[0][0]
b[1] = s[0][1]
b[2] = s[0][2]

a[1] = s[1][0] - b[0]
a[2] = s[2][0] - b[0]

for i in range(1, 3):
    for j in range(1, 3):
        if s[i][j] != a[i] + b[j]:
            print("No")
            exit()
print("Yes")
# Judge status: Accepted
s = list(input())
t = set(s)

if len(s) == len(t):
    print("yes")
else:
    print("no")
# Judge status: Accepted
d, m, s = map(int, input().split())
if (d/s) <= m:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s=input()
if s.count('N')==s.count('S')==0 or (s.count('N')>0 and s.count('S')>0):
  if s.count('E')==s.count('W')==0 or (s.count('E')>0 and s.count('W')>0):
    print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
S = input()
MOD = 10**9 + 7

A = [0]*26
for e in S:
    A[ord(e)-97] += 1

ans = 1
for e in A:
    ans *= e+1

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

for i in range(8):
    ans=int(s[0])
    op=[0]*3
    for j in range(3):
        if (i>>j)&1:
            ans+=int(s[j+1])
            op[j]='+'
        else:
            ans-=int(s[j+1])
            op[j]='-'
    if ans==7:
        print(s[0]+op[0]+s[1]+op[1]+s[2]+op[2]+s[3]+'=7')
        break
# Judge status: Accepted
# D - Integer Cards

from operator import itemgetter

N, M = map(int, input().split())
A = sorted([int(a) for a in input().split()])

BC = []
for i in range(M):
    b, c = map(int, input().split())
    BC.append([b, c])

BC = sorted(BC, key=itemgetter(1), reverse=True)

ans = 0
for i in range(N):
    if len(BC) != 0 and A[i] <= BC[0][1]:
        ans += BC[0][1]
        BC[0][0] -= 1
        if BC[0][0] == 0:
            BC.pop(0)
    else:
        ans += A[i]

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

# check
sort_d = sorted(d)
c = N // 2
print(len(list(range(sort_d[c - 1] + 1, sort_d[c]))))
# Judge status: Accepted
import re
print("WA" if re.match('^A[a-z]+C[a-z]+$',input()) == None else "AC")
# Judge status: Accepted
A, B, C = map(int, input().split())
Ans = 0
for i in range(A,B+1):
    if i % C == 0:
        Ans += 1
        
print(Ans)
# Judge status: Accepted
n,m,x = map(int,input().split())
ls = []
for i in range(n):
  ls.append(list(map(int,input().split())))
minimum = 10**12
for i in range(2**n+1):
  f = "{{:0{}b}}".format(n)
  now = f.format(i)
  understand = [0] * m
  cost = 0
  for j in range(len(now)):
    if now[j] == "1":
      cost += ls[j][0]
      for k in range(m):
        understand[k] += ls[j][k+1]
  if cost < minimum:
    if min(understand) >= x:
      minimum = cost
if minimum == 10**12:
  print(-1)
else:
  print(minimum)
# Judge status: Accepted
import sys

def resolve():
    readline=sys.stdin.readline
    k=int(readline())
    to=10**6
    svn=[0]*to
    svn[0]=7%k
    if svn[0]==0:
      print(1)
      return
    for i in range(1,to):
      svn[i]=(svn[i-1]*10)%k
    for i in range(1,to):
      svn[i]+=svn[i-1]
      if svn[i]%k==0:
        print(i+1)
        return
      
    print(-1)
    return
resolve()
# Judge status: Accepted
a=input()
b=input()
print("123".replace(a,"").replace(b,""))
# Judge status: Wrong Answer
n = int(input())
if n % 2 == 0:
  print(n / 2)
else:
  print((n+1)/2)
# Judge status: Accepted
ans = 10**9
N = int(input())
A = list(map(int,input().split()))
for i in A:
    p = 0
    while i % 2 == 0:
        i //= 2
        p += 1
    if p < ans:
        ans = p
print(ans)
# Judge status: Wrong Answer
N=input()
if N.find('7') > 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
x=int(input())
if 400<=x<599:
    print(8)
elif 600<=x<799:
    print(7)
elif 800<=x<1199:
    print(6)
elif 1200<=x<1399:
    print(5)
elif 1400<=x<1599:
    print(4)
elif 1600<=x<1799:
    print(2)
elif 1800<=x<1999:
    print(1)
# Judge status: Accepted
t = str(input())
res = ""
a = ""

for i in range(len(t)):
    if t[i] == "?":
        a = "D"
    else:
        a = t[i]
    res = res + a

print(res)
# Judge status: Accepted
from fractions import gcd

from functools import reduce


n = int(input())
a_list = [int(x) for x in input().split()]

temp = 1
for a in a_list:
    temp *= a // gcd(a, temp)

ans = 0
for a in a_list:
    ans += temp // a
mod = 10 ** 9 + 7
ans %= mod

print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
k = int(input())

ans = 'No'
d = 0

for i in range(1,k+1):
    if b <= a:
        d = d + 1
        b = b * 2
    else:
        d = d
        b = b

if d == k:
    if c > b:
        ans = 'Yes'

f = k - d
g = 1

for j in range(1,f+2):
    if c <= b:
        c = c * 2
    else:
        ans = 'Yes'

print(ans)
# Judge status: Accepted
A, B, K = map(int, input().split())
x = A
y = B
ans = set()
for _ in range(K):
  if A <= x <= B:
    ans.add(x)
  if A <= y <= B:
    ans.add(y)
  x += 1
  y -= 1

ans = sorted(ans)
print(*ans, sep='\n')
# Judge status: Wrong Answer
s = input()
t = input()
x = len(s)
z = 0
for i in range(x) :
  if s[i] == t[i] :
    z = z + 1
print(z)
# Judge status: Accepted
A,B = map(int,input().split())
su = abs(A -B)
count = 0
for i in range(A, B + 1):
    aa =str(i)
    rslt = aa[::-1]
    if aa == rslt:
        count += 1
print(count)
# Judge status: Accepted
c = ord(input())
print(chr(c + 1))
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())

N = I()

A = [1,6,9,36,81,216,729,1296,6561,7776,46656,59049]  # 引き出せる金額

dp = [0]*(N+1)  # dp[i] = i円引き出すのに必要な操作の回数
for i in range(N+1):
    if i == 0:
        continue
    else:
        a = N
        for j in A:
            if i >= j:
                a = min(a,dp[i-j]+1)
        dp[i] = a

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

x = 1/2*(i[1]-2*i[0])
print(x)
if x < i[0] & isinstance(x, int):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import numpy as np
N,D = (int(x) for x in input().split())
X = np.zeros((N,D),dtype=int)
for I in range(0,N):
    X[I,:] = np.array([int(x) for x in input().split()],dtype=int)
    
Count = 0
for I in range(0,N-1):
    for II in range(I+1,N):
        if np.linalg.norm(X[I,:]-X[II,:]).is_integer():
            Count += 1
print(Count)
# Judge status: Accepted
n,x = map(int, input().split())
a = []
cnt = 0
for i in map(int, input().split()):
    if x < i:
        cnt += i-x
        i = x
    a.append(i)

for i in range(1,n):
    if a[i-1] + a[i] > x:
        tmp = a[i] - (x - a[i-1])
        cnt += tmp
        a[i] -= tmp
print(cnt)

# print(a)
# Judge status: Accepted
a,b = map(int,input().split())
if a>=9 or b>=9:
  print(':(')
else:
  print('Yay!')
# Judge status: Accepted
n,y = map(int,input().split())
for i in range(n+1):
 for j in range(n-i+1):
  if i*10000 + j*5000 + (n-i-j)*1000 == y:
   print(i,j,n-i-j)
   exit()
print("-1 -1 -1")
# Judge status: Wrong Answer
n = int(input())
a = int(n/1.08)
if int(a*1.08) == n:
  print(a)
elif int((a+1)*1.08) == n:
  print(a+1)
else:
  (':(')
# Judge status: Accepted

l, r = map(int,input().split())
 
ans = 2019
for i in range(l, r):
    for j in range(i+1, r+1):
        tmp = i*j % 2019
        if ans > tmp:
            ans = tmp
        if ans == 0:
            print(ans)
            exit(0)
print(ans)
# Judge status: Accepted
x = int(input())
if(x == 0):
    print(1)
else:
    print(0)
# Judge status: Accepted
days = ['SUN','MON','TUE','WED','THU','FRI','SAT'] 
S = input()

print(7-days.index(S))
# Judge status: Accepted
from collections import Counter

S = [int(i) for i in input()]
S.reverse()
lst = []
_sum = 0

for i in range(len(S)):
    _sum = (_sum + S[i] * pow(10,i,2019)) % 2019
    lst.append(_sum)
    
C = Counter(lst)    
ans = C[0]

for i in C:
    ans += C[i]*(C[i]-1)//2
print(ans)
# Judge status: Wrong Answer
x, a, b = map(int, input().split())

if a - b > 0:
  print("delicious")
elif a + x > b:
  print("safe")
else:
  print("dangerous")
# Judge status: Wrong Answer
s = input()
int_s = 1000000

ans = 0
mul = 2019
while mul < int_s:
    sub_s = s
    f = sub_s.find(str(mul))
    while f != -1:
        ans += 1
        sub_s = sub_s[f+1:]
        f = sub_s.find(str(mul))
    mul += 2019

print(ans)
# Judge status: Accepted
n = int(input())
s = list(input())
l = []
for i in range(1, n):
    l.append(len(set(s[:i]) & set(s[i:])))
print(max(l))
# Judge status: Accepted
# <>>><<><<<<<>>><
# >< is 0
S = input()
part = S.replace('><','> <').split(' ')

ans=0
for p in part:
    left  = p.count('<')
    right = p.count('>')
    ans += sum(range(1, max(left, right) + 1))
    ans += sum(range(1, min(left, right)))

print(ans)
# Judge status: Accepted
N,M=map(int,input().split())
A=list(map(int,input().split()))

su=sum(A)
i=0
while max(A)*4*M>=su:
    i+=1
    A.remove(max(A))
    if i>=M:
        print("Yes")
        break
else:
    print("No")
# Judge status: Accepted
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))

aa = sorted(a, reverse=True)

suma = sum(aa)
threshold = suma / (4 * m)

if aa[m-1] >= threshold:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
n, m = map(int, input().split())
 
g = [[] for _ in range(n)]
for _ in range(m):
    u, v = map(int, input().split())
    g[u-1].append(v-1)
    g[v-1].append(u-1)

N = n-1
for i in g[0]:
    if N in g[i]:
        print('POSSIBLE')
        sys.exit()

print('IMPOSSIBLE')
# Judge status: Wrong Answer
n = int(input())
a = sorted(list(map(int,input().split())),reverse = True)
c_ls = []
for i in range(n-1):
  if (a[i] == a[i+1]) and(a[i] not in c_ls):
    c_ls.append(a[i])
    if len(c_ls) == 2:
      print(c_ls[0]*c_ls[1])
      exit()
print(0)
# Judge status: Wrong Answer
a,b = map(int,input().split())
sumA = 0
count  =0
t = True
while t:
    if sumA<=b:
        count +=1
    elif sumA>=b:
        t = False
    sumA += a
print(count)
# Judge status: Accepted
s=input().split()
s=[s[i][0] for i in range(len(s))]
print("".join(s))
# Judge status: Wrong Answer
N = int(input())
Alist = list(map(int, input().split()))
Blist = list(map(int, input().split()))
amari = 0
ans = 0
for i in range(N):
    can_kill = amari + Blist[i]
    enemy = Alist[i]
    if can_kill > enemy:
        ans += enemy
        amari = can_kill - enemy
    else:
        ans += can_kill
        amari = 0
if amari > Alist[-1]:
    ans += Alist[-1]
else:
    ans += amari
print(ans)
# Judge status: Wrong Answer
import sys
n = int(input())
w = list(map(int,input().split()))
a = 0
b  = sum(w)
for i in range(n):
    a += w[i]
    b -= w[i]
    if a > b:
        print(a-b)
        sys.exit()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

current = 1
broken = 0
for i in range(n):
    if a[i] == current:
        current += 1
    else:
        broken += 1
if current == 1 and broken > 0:
    print('-1')
else:
    print(broken)
# Judge status: Accepted
X, N = map(int, input().split())
P = list(map(int, input().split()))

if not X in P:
    print(X)
else:
    for i in range(100):
        if not X-i in P: 
            tmp = True
            break
        elif not X+i in P: 
            tmp = False
            break
    print(X-i if tmp else X+i)
# Judge status: Accepted
from sys import stdin
N = int(stdin.readline().rstrip())

XL = []
for i in range(N):
    x, l = [int(_) for _ in stdin.readline().rstrip().split()]
    XL.append([x-l, x+l])
XL = sorted(XL, key=lambda x: x[1])

ans = 0
tmp = -10**9
for i in range(N):
    if XL[i][0] >= tmp:
        tmp = XL[i][1]
        ans += 1
print(ans)
# Judge status: Wrong Answer
K = int(input())
gcd_sum = 0
for a in range(1,K+1):
	a_init = a
	for b in range(1, K+1):
		b_init = b
		for c in range(1, K+1):
			a = a_init
			b = b_init
			m = min(a, b, c)
			gcd = 1
			for i in range(2, m+1):
				if a%i == 0 and b%i == 0 and c%i == 0:
					a /= i
					b /= i
					c /= i
					gcd *= i
			gcd_sum += gcd
print(gcd_sum)
# Judge status: Accepted
n = int(input())
print(int(n**.5) ** 2)
# Judge status: Accepted
import collections,itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,W = LI()
wv = [LI() for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)] #1_indexed
for i,j in itertools.product(range(1,N+1),range(W+1)):
    w,v = wv[i-1]
    if j-w>=0:
        dp[i][j] = max(dp[i][j],dp[i-1][j-w]+v)
    dp[i][j] = max(dp[i][j],dp[i-1][j])
print(dp[-1][-1])
# Judge status: Accepted
import collections
n=int(input())
count=0
a=[int(input()) for _ in range(n)]
a=collections.Counter(a)

for key,value in a.items():
    if value%2==1:
        count+=1
print(count)
# Judge status: Accepted
N = int(input())
L = sorted( list( map(int, input().split() ) ) )
print('Yes') if sum(L) > 2*L[N-1] else print("No")
# Judge status: Wrong Answer
N,A,B = map(int,input().split())
total = []
ans = []
for i in range(A,N+1):
  if i == 1000:
    total.append(1)
  elif i<10 and i<=B:
    total.append(i)
  elif i>=10 and i<100:
    i = str(i)
    if int(i[0])+int(i[1])<=B and int(i[0])+int(i[1])>=A:
      total.append(int(i))
  elif i>=100 and i<1000:
    i = str(i)
    if int(i[0])+int(i[1])+int(i[2])<=B and int(i[0])+int(i[1])+int(i[2])>=A:
      total.append(int(i))
print(sum(total))
# Judge status: Wrong Answer
def main():
    n = int(input())
    t, a = map(int, input().split())
    h = list(map(int, input().split()))
    ave_t = []
    for x in h:
        ht = abs(a - t - x * 0.006)
        ave_t.append(ht)
    print(ave_t.index(min(ave_t))+1)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
ans = 0
for X in range(1, N+1):
  Y = N // X
  ans += Y * (Y + 1) // 2 * X
print(ans)
# Judge status: Wrong Answer
n = int(input())
P = list(map(int,input().split()))
P = [int(i+1==P[i]) for i in range(n)]+[0]

ans = 0
ex = 0
for p in P:
  if p and ex:
    ans += 1
    ex = 0
  elif p:
    ex = 1
  elif ex:
    ans += 1
print(ans)
# Judge status: Accepted
from math import sqrt
def main():
    a, b, c = map(int, input().split())
    if 4*a*b < (c - a - b) ** 2 and (c-a-b) >= 0:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
a = []
for i in range(N):
    b = int(input())
    a.append(b)
ans = 0
tmp = 1
flag = False
while(1):
    tmp = a[tmp-1]
    ans += 1
    if tmp==2:
        flag = True
        break
    if ans > N:
        break
if flag:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()
M = a[-1]
m = a[0]
C = -1
for i in range(n):
  c = a[i]*(M-a[i])
  if C < c:
    C = c
    m = a[i]
  else:
    break
print(M, m, sep=' ')
# Judge status: Accepted
# 数値の取得
N = str(input())

# 数値の検証
f_cnt = (N[:3]).count(N[:1])
l_cnt = (N[1:]).count(N[3:])
if f_cnt == 3\
or l_cnt == 3:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s= input()
l = list(s)
ans= "Yes"
for i in range(0,(len(s)//2)):
  if(l[i]!=l[-1-i]):
    ans = "No"
print(ans)
# Judge status: Accepted
import math

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

sum = 0

for i in range(N):
    for j in range(N):
      dx = abs(x[i]-x[j])
      dy = abs(y[i]-y[j])
      sum = sum + math.sqrt((dx*dx) + (dy*dy))

    
ave = sum/math.factorial(N)*math.factorial(N-1)

print(ave)
# Judge status: Accepted
import sys 
from functools import reduce
from math import gcd
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 10 ** 9 + 7
N = int(readline())
A = list(map(int,readline().split()))
lcm = reduce(lambda x,y:x*y//gcd(x,y),A)
ans = 0
ans = sum(lcm//x for x in A)
print(ans%mod)
# Judge status: Accepted
import sys
s = sys.stdin.readline().rstrip("\n")
t = sys.stdin.readline().rstrip("\n")
s_ = sorted(s)
s_ = ''.join(s_)
t_ = sorted(t, reverse=True)
t_ = ''.join(t_)
if s_ < t_:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n=int(input())
a=int(input())
if n%500 <= a:
	print('Yes')
else:
	print('No')
# Judge status: Accepted
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()

cnt = 0
has_zero = False

for item in a_list:
    if item < 0:
        cnt += 1
    elif item == 0:
        has_zero = True

abs_list = list(map(abs, a_list))
abs_list.sort()

if has_zero:
    print(sum(abs_list))
elif cnt % 2 == 0:
    print(sum(abs_list))
else:
    print(sum(abs_list) - 2 * abs_list[0])
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
b=min(A)
index=A.index(b)

for i in range(0,N):
    if A[i] != min(A[i],A[N-1]):
        A[i],A[index] = A[index],A[i]
        break
        
if sorted(A)==A:
    print("YES")

else:
    print("NO")
# Judge status: Accepted
n = int(input())
print(min(bin(int(i))[::-1].find("1") for i in input().split()))
# Judge status: Accepted
def main():
    S = int(input())
    x1, y1 = 0, 0
    if S < 10**18:
        x2, y2 = 10**9, 1
        y3 = S // x2 + 1
        x3 = x2 * y3 - S
    else:
        x2, y2 = 10**9, 0
        x3, y3 = 0, 10**9
    print(' '.join(map(str, [x1, y1, x2, y2, x3, y3])))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N=int(input())
h=list(map(int,input().split()))
dp=[0]
cost=[]
for i in range(1,N):
    cost=[]
    cost.append(abs(h[i]-h[i-1])+dp[i-1])
    if i>=2:
        cost.append(abs(h[i]-h[i-2])+dp[i-2])
    dp.append(min(cost))
print(dp[N-1])
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
x1 = []
x2 = []
x4 = []
for i in range(n):
    if a[i] % 4 == 0:
        x4.append(a[i])
    elif a[i] % 2 == 0:
        x4.append(a[i])
    else:
        x1.append(a[i])
if len(x2) == 0:
    if len(x1) <= len(x4)+1:
        print("Yes")
    else:
        print("No")
else:
    if len(x1) <= len(x4):
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
a, b, x = map(int, input().split())

if x >= a**2*b/2:
    t = 2*(b*a**2-x)/(a**3)
else:
    t = (a*b**2)/(2*x)

import math
p = math.atan(t)
p = math.degrees(p)
print(p)