peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))
if n<=2:print(1);exit()
ans=1
chk=0
while chk<n-2:
  if (l[chk]-l[chk+1])*(l[chk+1]-l[chk+2])<0:ans+=1;chk+=2
  else:chk+=1
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

a, b, c = map(int, input().split())
print(a*b//2)
# Judge status: Accepted
n = int(input())
for i in range(8):
    if 2**i>n:
        print(2**(i-1))
        break
# Judge status: Accepted
n=int(input())

ab=[list(map(int, input().split())) for _ in range(n)]

ab=ab[::-1]

cnt=0
for [a,b] in ab:
    if (a+cnt)%b!=0:
        cnt+=(b)-(a+cnt)%b
    #print(a,b,cnt)
print(cnt)
# Judge status: Accepted
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
    print(a-1, b)
else:
    print(a, b-1)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

S, T = input().split()
A, B = map(int, input().split())
U = input()

if S==U:
  print(A-1,B)

if T==U:
  print(A,B-1)
# Judge status: Wrong Answer
h,a = map(int,input().split())

print(h // a + 1)
# Judge status: Accepted
A, B, C = map(int, input().split())

A, B = B, A
A, C = C, A

print(A, B, C)
# Judge status: Wrong Answer
S = list(input())

S.sort()

for i in range(len(S)-1):
    if ord(S[i+1]) - ord(S[i]) == 0 or ord(S[i+1]) - ord(S[i]) == 1:
        pass
    else:
        res = ord(S[i]) + 1
        print(chr(res))
        exit()

res = ord(S[-1]) + 1

if S[0] == 'a' and S[-1] == 'z':
    print('None')
elif S[0] != 'a':
    res = ord(S[0]) - 1
    print(chr(res))
else:
    print(chr(res))
# Judge status: Accepted
s = str(input())
if s[-1] == "s":
  print(s+"es")
else:
  print(s+"s")
# Judge status: Wrong Answer
O = input()
E = input()

print(*[x + y for x,y in zip(O,E)],sep='')
# Judge status: Accepted
S=input()
T=input()
print("Yes" if S==T[:len(T)-1] and len(S)+1==len(T) else "No")
# Judge status: Accepted
line = list(map(int,input().split()))
dx = line[2]-line[0]
dy = line[3]-line[1]
for i in range(dx):
	print('R',end='')
for i in range(dy):
	print('U',end='')
for i in range(dx):
	print('L',end='')
for i in range(dy+1):
	print('D',end='')
for i in range(dx+1):
	print('R',end='')
for i in range(dy+1):
	print('U',end='')
print('LU',end='')
for i in range(dx+1):
	print('L',end='')
for i in range(dy+1):
	print('D',end='')
print('R')
# Judge status: Accepted
n = int(input())
ans = 1
while ans <= n//2:
  ans *= 2
print(ans)
# Judge status: Accepted
S=input()
T=input()



def encode(S):
  dict={}
  now=0
  result=""
  for s in S:
    if s not in dict.keys():
      dict[s]=str(now)
      now+=1
    result=result+dict[s]
  return result

if encode(S)!=encode(T):
  print("No")
else:
  print("Yes")
#print(encode(S),encode(T))
# Judge status: Wrong Answer
money = int(input())

num_500 = int(money / 500)

remaining = int(money % 500)

num_5 = int(remaining / 5)

print('{}'.format(num_500 * 1000 + num_5 * 500 ))
# Judge status: Accepted
A,B,C = list(map(int,input().split()))
ans = 0
if B + C * 2 > A:
    print(ans)
    exit()
A -= B + C * 2
ans += 1
while A // (B+C) >= 1:
    A -= B + C 
    ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
for a_, b_ in zip(a, b):
    if a_ > b_:
        cnt += a_ - b_
    else:
        cnt -= (b_ - a_) // 2
if cnt <= 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
#!/usr/bin/env python3
ALPHABET = "abcdefghijklmnopqrstuvwxyz"
n = int(input()) - 1
ans = ""
while True:
    ans += ALPHABET[n % 26]
    n //= 26
    n -= 1
    if n < 0:
        break
print(ans[::-1])
# Judge status: Accepted
a, b = map(int, input().split())

if a>b:
    for i in range(a):
        print(b,end='')
else:
    for i in range(b):
        print(a,end='')
# Judge status: Accepted
n=int(input())
d=dict()
for _ in range(n):
    a=int(input())
    if a not in d:
        d[a]=0
    else:
        del d[a]
print(len(list(d)))
# Judge status: Accepted
import sys
input = sys.stdin.readline


def main():
    A = {1, 3, 5, 7, 8, 10, 12}
    B = {4, 6, 9, 11}
    C = {2}
    xy = set(map(int, input().split()))
    if xy <= A or xy <= B or xy <= C:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()
# Judge status: Accepted
s=input()
ans=0
for c in s:
    ans+=int(c)
    ans%=9
if ans==0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
    exit()

l = l%2019
r = r%2019

if l >= r:
    print(0)
else:
    ans = float('inf')
    for left in range(l, r):
        for right in range(left+1, r+1):
            ans = min(ans, (left*right)%2019)
    print(ans)
# Judge status: Wrong Answer
N = int(input())
v = [list(map(int, input().split())) for i in range(N)]
minx = min([v[i][0] for i in range(N)])
miny = min([v[i][1] for i in range(N)])
v.sort(key = lambda x:x[0] - minx + x[1] - miny)
d = abs(v[0][0] - v[N-1][0]) + abs(v[0][1] - v[N-1][1])
print(d)
# Judge status: Wrong Answer
n,k = map(int,input().split())
A = list(map(int,input().split()))

d = {i:0 for i in set(A)}
for a in A:
    d[a] += 1
ans = list(d.values())
ans.sort
print(sum(ans[k:]))
# Judge status: Accepted
n,m=map(int,input().split())
d=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  d[a-1]+=1
  d[b-1]+=1
for i in d:
  print(i)
# Judge status: Accepted
S = input()

N = len(S) + 1
t = [0] * N
for i in range(N - 1):
    if S[i] == '<':
        t[i + 1] = t[i] + 1
for i in range(N - 2, -1, -1):
    if S[i] == '>':
        t[i] = max(t[i], t[i + 1] + 1)
print(sum(t))
# Judge status: Wrong Answer
N = int(input())
G0, G1, G2, G3 = 0, 0, 0, 0
for i in range(N):
    Si=input()
    if Si == 'AC':
        G0 += 1

    elif Si=='WA':
        G1 += 1

    elif Si=='TLE':
        G2 += 1
    
    else:
        G3 += 1
 
print('AC x' +str(G0))
print('WA x' +str(G1))
print('TLE x'+str(G2))
print('RE x' +str(G3))
# Judge status: Accepted
X = int(input())
x = 1
while True:
    if X*x % 360  == 0:
        print(x)
        break
    x += 1
# Judge status: Accepted
N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]
ans = 0
from itertools import combinations_with_replacement
l = [i for i in range(1, M+1)]
lis = list(combinations_with_replacement(l, N))

for l in lis:
    tmp = 0
    for j in range(Q):
        a, b, c, d = abcd[j]
        if l[b-1]-l[a-1]==c:
            tmp+=d
    ans = max(tmp, ans)

print(ans)
# Judge status: Wrong Answer
s=input()
ans=0
pre=""
for i in s:
  if pre!=i:
    pre=i
    ans+=1
  else:pre+=i
print(ans+int(len(pre)>=2))
# Judge status: Wrong Answer
import itertools
import math
N=int(input())
R=list(range(1,N+1))
a=tuple(map(int,input().split()))
ai=0
b=tuple(map(int,input().split()))
bs=0
c=0
K=list(itertools.permutations(R))
for i in range(math.factorial(N)):
  if K[i]==a:
    ai=i
    c+=1
  elif K[i]==b:
    bs=i
    c+=1
  elif c==2:
    break
print(abs(ai-bs))
# Judge status: Accepted
s=input()+' '
p=0
l=list()
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        p+=1
    else:
        if s[i]=='<':
            l.append([0,'<',p+1])
        else:
            l.append([p+1,'>',0])
        p=0
a=sum([sum(range(i[2]+1)) if i[1]=='<' else sum(range(i[0]+1)) for i in l])
b=sum([min(l[i][2],l[i+1][0]) for i in range(len(l)-1)])
print(a-b)
# Judge status: Wrong Answer
n = int(input())
n3 = n // 3
n5 = n // 5
n15 = n // 15

print(n*(n+1)/2 + 3*n3*(n3+1)/2 + 5*n5*(n5+1)/2 - 15*n15*(n15+1)/2)
# Judge status: Wrong Answer
def resolve():
    a, b, c, d = list(map(int, input().split()))

    if b > 0 and d > 0:
        print(b * d)
    elif b > 0 and d < 0:
        print(d * a)
    elif b < 0 and d > 0:
        print(c * b)
    else:
        print(a * c)
    
resolve()
# Judge status: Accepted
MOD = 1000000007


def cal(a, n):
    if n == 1:
        return a
    if n % 2 == 0:
        return (cal(a, n // 2) % MOD) ** 2 % MOD
    else:
        return (cal(a, n - 1) % MOD) * a % MOD


def cal_p(n, r):
    res = 1
    for i in range(r):
        res = res * (n - i) % MOD

    return res


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

all = cal(2, n) - 1
A = cal_p(n, a) * cal(cal_p(a, a), 1000000005) % MOD
B = cal_p(n, b) * cal(cal_p(b, b), 1000000005) % MOD

print((all - A - B) % MOD)
# Judge status: Accepted

import math
H = int(input())
print(2**(int(math.log2(H))+1)-1)
# Judge status: Accepted
n,a,b=map(int,input().split())
s=str(input())
o=0
e=0
for i in range(n):
  if s[i]=='a':
    if o<a+b:
      o+=1
      print('Yes')
    else:
      print('No')
  elif s[i]=='b':
    if o<a+b and e<b:
      o+=1
      e+=1
      print('Yes')
    else:
      print('No')
  else:
    print('No')
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
k, n = map(int, input().split()) # 入力が複数
houses = list(input().split())
houses = [int(h) for h in houses]
houses.sort()
houses.append(k)
max_dist = 0
total = 0
for i in range(n):
    d = houses[i + 1] - houses[i]
    max_dist = max(max_dist, d)
    total += d

ans = total - max_dist
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
s_c = [list(map(int, input().split())) for _ in range(M)]

if N == 1:
  a, b = 0, 10**N
elif N >= 2:
  a, b = 10**(N-1), 10**N

ans = '-1'
for i in range(a, b):
  flag = True
  for j in range(M):
    if str(i)[s_c[j][0]-1] != str(s_c[j][1]):
      flag = False
  if flag:
    ans = i
    break

print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
if 13<=a:
  print(b)
elif 6<=a<=12:
  print(b//2)
else:
  print(0)
# Judge status: Accepted
n = int(input())
w = []
for i in range(n):
    w.append(str(input()))
ans = "Yes"

for i in range(1, n):
    if w[i-1][-1] != w[i][0]:
        ans = "No"
        break

if len(set(w)) != len(w):
    ans = "No"

print(ans)
# Judge status: Accepted
S = input()

DAY = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

print(7-DAY.index(S))
# Judge status: Accepted
print(min(set(map(chr,range(97,123)))-set(input())or[None]))
# Judge status: Wrong Answer
n,m=map(int,input().split())
c = [0]*m
for i in range(n):
  a = list(map(int, input().split()))
  for e in a:
    c[e-1] += 1
print(c.count(n))
# Judge status: Wrong Answer
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
ans = [0] * k
s = sum(p[0:k])
s_max = 0
for i in range(n-k):
    s = s-p[i] + p[i+k]
    s_max = max(s_max,s)
if s_max % 2 == 0:
    print(ex_even(s_max) + 0.5*(k-1))
else:
    print(ex_odd(s_max) + 0.5*(k-1))
# Judge status: Accepted
#coding: utf-8
num1, num2= list(map(int, input().split()))
print(num1*num2)
# Judge status: Accepted
n = str(input())

if n[0]=='9' or n[1]=='9':
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
# coding: utf-8
sa = input()
sb = input()
sc = input()
d = {"A":sa, "B":sb, "C":sc}
s = d["A"][0].upper()
d["A"] = d["A"][1:]
while True:
    if len(d[s]) == 0:
        print(s)
        break
    tmp = d[s][0].upper()
    d[tmp] = d[tmp][1:]
    if len(d[tmp]) == 0:
        print(tmp)
        break
    s = tmp[:]
# Judge status: Accepted
c500 = int(input())
c100 = int(input())
c50 = int(input())
x = int(input())
count = 0
 
for c500_n in range(c500+1):
  for c100_n in range(c100+1):
    for c50_n in range(c50+1):
      if c500_n*500 + c100_n*100 + c50_n*50 == x:
        count += 1
 
print(count)
# Judge status: Wrong Answer
import math

a,b = (str(i) for i in input().split())

c = a + b

c = int(c)

if c / math.sqrt(c) == math.sqrt(c):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
c = input()
n = len(c)//2
ans = min(c.count('W',0,n), c.count('R',n,n*2))
print(ans)
# Judge status: Wrong Answer
S = input()
na = S.count("a")
nb = S.count("b")
nc = S.count("c")

nall = na+nb+nc
mx = max(na,nb,nc)
mn = min(na,nb,nc)
rest = nall - mx
if len(S) >= 3 and mx - rest == 1 and mn == 0:
    print("NO") 
else:
    if mx - rest >= 2:
        print("NO")
    else:
        print("YES")
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split(' ')))
import math
import collections
import operator as op
from functools import reduce
def nCr(n,r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom if n>1 else 0
counter=collections.Counter(A)
penult=0
for i in range(1,N+1):
    penult=penult+nCr(counter[i],2)
for i in range(0,N):
    print(int(penult-(counter[A[i]]-1)))
# Judge status: Accepted
a,b,c=map(int,input().split())
n=int(input())

a,b,c= sorted([a,b,c])
print(a+b+c*2**n)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

MAX = [1] * (N+1)
ans = [0] * (N+1)
INF = 10**15

if N == 0 and A[0] != 1:
    print(-1)
    exit()

for i in range(1, N+1):
    MAX[i] = min((MAX[i-1] - A[i-1]) * 2, INF)
    if MAX[i] < A[i]:
        print(-1)
        exit()

ans[N] = A[N]

for i in reversed(range(N)):
    ans[i] = min(ans[i+1]+A[i], MAX[i])

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

sum_A = 0
for item in A:
  sum_A ^= item

ans = [str(sum_A ^ item) for item in A]
print(" ".join(ans))
# Judge status: Wrong Answer
x,n = map(int,input().split())
p = list(map(int,input().split()))
notp = []

for i in range(0,101):
  if i not in p:
    notp.append(i)

for j in range(len(notp)):
  if j != len(notp)-1:
    
    if abs(x-notp[j+1]) >= abs(x-notp[j]):
      print(notp[j])
      break
  else:
    print(notp[j])
    break
# Judge status: Wrong Answer
D,T,S = map(int,input().split())
if D//S>T:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
n = int(input())
if(n < 10):
  print(n)
elif(n < 100):
  print(9)
elif(n < 1000):
  print(9 + n -100)
elif(n < 10000):
  print(908)
elif(n < 100000):
  print(908 + n-10000)
else:
  print(90909)
# Judge status: Accepted
a,b,n = map(int,input().split())
ans = 0
q = 0

if(n>=b):
  if((n+1)%b == 0):
    q = (n+1)/b - (n+1)//b
  else:
    tmp = (n//b)*b - 1
    q = tmp/b -tmp//b
else:
  q = n/b

print(int(a*q))
# Judge status: Accepted
a, b = map(int, input().split())

ans = str()
if a == 1 or b == 1:
    if a == 1 and b == 1:
        ans = "Draw"
    elif a == 1:
        ans = "Alice"
    elif b == 1:
        ans = "Bob"
else:
    if a > b:
        ans = "Alice"
    elif b > a:
        ans = "Bob"
    else:
        ans = "Draw"

print(ans)
# Judge status: Wrong Answer
import sys, math
from collections import defaultdict
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
A = rl()

B = [0] * N

R = [0] * N
for i in range(N-1, -1, -1):
	if R[i] % 2 == A[i]:
		B[i] = 0
	else:
		B[i] = 1
		n = i+1
		j = 1
		while j*j <= n:
			if n % j == 0:
				R[j-1] += 1
			j += 1

ans = [i+1 for i, b in enumerate(B) if b == 1]
print(len(ans))
print(*ans)
# Judge status: Wrong Answer
a,b,c = map(int, input().split())


A=a-b 
B=a-c


if (A==0 and B!=0) or (B==0 and A!=0):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
S = input()
ans = ''
for i in range(len(S)):
  temp = ord(S[i]) - ord('A') + N
  ans += chr(ord("A") + temp%26 )
print(ans)
# Judge status: Accepted
N=input()
L=list(N)
L.sort()
if L[0]=='a' and L[1]=='b' and L[2]=='c':
  print('Yes')
else:
  print('No')
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
p,q,r = map(int, input().split())

print(p+q+r-max(p,max(q,r)))
# Judge status: Wrong Answer
import math

N,M = map(int,input().split())
n_of_city = [0]*N
MAIN = []
for i in range(M):
    P,Y = map(int,input().split())
    left_number = "0"*(5 - round(math.log10(P))) + str(P)
    MAIN.append([i,P,Y,left_number])
    
MAIN.sort(key=lambda x:x[2])
for city in MAIN:
    n_of_city[city[1] - 1] += 1
    num = n_of_city[city[1] - 1]
    right_number = "0"*(5 - round(math.log10(num))) + str(num)
    city.append(right_number)

MAIN.sort(key=lambda x:x[0])
for city in MAIN:
    print(city[3] + city[4])
# Judge status: Wrong Answer
N = int(input())
if N % 2 == 1:
    print(0)
    quit()
N /= 2
res = 0
while N:
    #print(N)
    res += int(N / 5)
    N = int(N / 5)
print(res)
# Judge status: Accepted
n = int(input())
seen = set()
for i in range(n):
    s = input()
    if i > 0 and s[0] != pre or s in seen:
        print('No')
        break
    seen.add(s)
    pre = s[-1]
else:
    print('Yes')
# Judge status: Accepted
n,m=map(int,input().split())
d=[]
f=1
while f*f<m+1:
  if m%f==0:
    d.append(f)
    d.append(m//f)
  f+=1
d.sort(reverse=True)
for i in d:
  if  (m-i*n)>=0 and (m-i*n)%i==0 :break
print(i)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))
n = N - K
if n % (K - 1) == 0:
  ans = 1 + n // (K - 1)
else:
  ans = 2 + n // (K - 1)
print(ans)
# Judge status: Accepted
a = int(input())
print(a*(a+1)//2)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=sum(a)
c=1
ans=1
if a[0]==1 and n==0:
    print(1)
    exit()
if a[0]>0:
    print(-1)
    exit()
for i in a[1:]:
    b-=i
    c=min(c*2-i,b)
    ans+=c
    if c<0:
        print(-1)
        exit()
print(ans+sum(a))
# Judge status: Accepted
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

x = INT()
a = (x//500)*1000 + ((x-(x//500)*500)//5)*5
print(a)
# Judge status: Accepted
import sys
read = lambda: sys.stdin.readline().rstrip()
 
def main():
    INF = 10 ** 20
 
    n,k = map(int,input().split())
    h = tuple(map(int,read().split()))
    dp = [INF]*(n+1)
    dp[0] = 0
 
    for i in range(1, n):
        for j in range(1, k + 1):
            if i-j >= 0: dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))
 
    print(dp[n-1])
if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())

for i in range(1,10):
    for j in range(1,10):
        if n==i*j:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
import math
N, A, B = list(map(int, input().split()))


def sum_of_digits(n):
    res = 0
    while n > 0:
        res += n % 10
        n = math.floor(n / 10)
    return res


total = 0
for i in range(1, N+1):
    s = sum_of_digits(i)
    if s >= A and s <= B:
        total += i
print(total)
# Judge status: Accepted
s = input()
s = s.replace('?', 'D')
print(s)
# Judge status: Accepted
n, m = map(int, input().split())
l = []
for i in range(m):
  l.extend(map(int, input().split()))
for i in range(n):
  print(l.count(i+1))
# Judge status: Accepted
N,P=map(int, input().split())
if N<=9:
    print(100*(10-N)+P)
else:
    print(P)
# Judge status: Wrong Answer
l,r = map(int,input().split())
if l - r >= 2019:
     print(0)
else:
     s = l % 2019

     if s + r - l >= 2019:
          print(0)
     else:
          print((s*(s+1))%2019)
# Judge status: Wrong Answer
from itertools import groupby

def main():
    X = input()
    count = 0
    gp = []
    for key,value in groupby(X):
        gp.append(list(value))
    for i in range(len(gp)-1):
        if gp[i][0] == "S":
            count += min(len(gp[i]),len(gp[i+1]))*2
    tmp = len(X)-count
    count = 0
    for i in range(450):
        count += X.count("ST")
        X = X.replace("ST","")
    print(min(len(X),tmp))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N, K = map(int, input().split())
num = ["0","1","2","3","4","5","6","7","8","9"]
dis = input().split()
can_use = sorted(list(set(num)-set(dis)), reverse=True)

sN = str(N)
L = len(sN)
ans = ""

if sN[0] in can_use:
    ans += sN[0]
else:
    if can_use[0] == "0":
        ans += can_use[1]
    else:
        ans += can_use[0]

for i in range(1,L):
    if sN[i] in can_use:
        ans += sN[i]
    else:
        ans += min(can_use)

print(ans)
# Judge status: Accepted
#174 A
X = input()
print('Yes') if int(X)> 29 else print('No')
# Judge status: Wrong Answer
import math
n = int(input())
X = list(map(int, input().split()))

p=(math.ceil(sum(X)/n))
cnt=0
for x in X:
  cnt += (x-p)**2
  
print(cnt)
# Judge status: Wrong Answer
x,y=map(int,input().split())
if x<y:
  z=0
  for i in range(0,x+1):
    z+=10**i*x
  print(z)
else:
  z=0
  for i in range(0,y+1):
    z+=10**i*y
  print(z)
# Judge status: Accepted
s = input()

if s == "RRR":
    print(3)
elif s == "RRS" or s == "SRR":
    print(2)
elif s == "SSS":
    print(0)
else:
    print(1)
# Judge status: Accepted
N = int(input())
L = []
for i in range(1,10):
    for j in range(1,10):
        L.append(i*j)
if N in L:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
  for j in range(i+1,n):
    tmp = gcd(a[i], a[j])
    if ans < tmp:
      ans = tmp
print(ans)
# Judge status: Accepted
X, Y = map(int, input().split())
mod = 10**9+7

plus = X+Y

if not plus%3==0:
    print(0)
elif abs(X-Y)>plus//3:
    print(0)
else:
    row = plus//3
    col = Y-row
    l, r = 1, 1
    for c in range(col):
        l = (l*(row-c))%mod
        r = r*(c+1)%mod
    print((l*pow(r, mod-2, mod))%mod)
# Judge status: Accepted
a, b = map(int, input().split())

if 0 < a:
    print('Positive')
elif a <= 0 <= b:
    print('Zero')
else:
    print('Negative' if (b-a+1)%2 else 'Positive')
# Judge status: Wrong Answer
import math
n = int(input())
print(math.floor(n/2)/n)
# Judge status: Wrong Answer
N, T = map(int, input().split())

ans = '1000'

for i in range(N):
    c, t = input().split()
    if int(t) <= T:
        if int(c) <= int(ans):
            ans = c
            
if ans == '1000':
    print('TLE')
else:
    print(ans)
# Judge status: Accepted
N=int(input())
A=int(input())
if N%500<=A:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
X,Y=map(int,input().split())
if (X+Y)%3!=0:
    print(0)
    sys.exit()
mod=10**9+7
A=(X+Y)//3
B=min(X,Y)-A

comb=[1]
for i in range(B):
    den=i+1
    num=A-i
    ans=comb[i]*num*pow(den,mod-2,mod)%mod
    comb.append(ans)
print(comb[-1])
# Judge status: Wrong Answer
n = int(input())
s = list(input())
cnt = 0
for i in range(n-1):
    if s[i] == '#' and s[i+1] == '.':
        cnt += 1
        s[i+1] = '#'
print(cnt)
#print(s)
# Judge status: Accepted
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
L = [0]*(N+1)
for a in A:
  L[a]=-1
L[0] = 1
L[1] += 1
for i in range(2, N+1):
  if L[i]==-1:
    L[i]=0
  else:
    L[i] = L[i-1]+ L[i-2]
print(L[-1]%(10**9+7))
# Judge status: Accepted
k = int(input())
print((k//2) * ((k+1)//2))
# Judge status: Accepted
n = int(input())
power = 1
for i in range(1, n+1):
    power *= i
    power %= 1000000007

print(power)
# Judge status: Wrong Answer
o = input()
e = input()
a = ""

for i in range(len(e)):
    a += o[i]
    if i < len(e):
        a += e[i]

print(a)
# Judge status: Accepted
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    if N%10==9 or N//10==9:
        print("Yes")
    else:
        print("No")

main()
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
sum = int(0)
arai = int(0)
ans = int(0)
mini = float('inf')

for i in range(N):
	sum+=a[i]
for i in range(N-1):
	ans+=a[i]
	arai=sum-ans
	mini=min(mini,float(abs(ans-arai)))

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

cost = 100000

for i in range(n):
    c, t = map(int, input().split())
    if t < T:
        cost = min(cost, c)

if cost == 100000:
    print('TLE')
else:
    print(cost)
# Judge status: Accepted
import math


def main():
    a, b, h, m = [int(e) for e in input().split()]

    ht = (h/12 + m/720) * 2 * math.pi
    mt = (m/60) * 2 * math.pi
    theta = min(abs(ht - mt), 2 * math.pi - abs(ht - mt))

    ans = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(theta))
    print(ans)


if __name__ == '__main__':
    main()