peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
d = dict()
for i in range(N):
    d[A[i]]=0
for n in range(N):
    
    if d[A[n]] == 1:
        print("NO")
        break
    if n == N-1:
        print("YES")
    d[A[n]] = 1
# Judge status: Accepted
H1,M1,H2,M2,K=map(int,input().split())

up=60*(H2-H1)+(M2-M1)
print(up-K)
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

if N % (K-1) == 0:
    ans = N // (K-1)
else:
    ans = (N // (K-1)) + 1
    if N == K:
        ans -= 1

print(ans)
# Judge status: Accepted
n,x,t = map(int,input().split())
if n % x == 0:
  print(n // x * t)
else:
  print(n // x * t + t)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ch1 = 0
for i in a:
	if(i == 0):
		print(0)
		ch1 = 1
		break

if(not ch1):
	ans = 1
	ch2 = 0
	for i in a:
		ans*=i
		if(ans > int(1e18)):
			print(-1)
			ch2 = 1
			break
	if(not ch2):
		print(ans)
# Judge status: Wrong Answer
x, a, b = map(int, input().split())

if a - b > 0:
    print('delicious')
elif b - a <= x:
    print('safe')
else:
    print('dangerous')
# Judge status: Accepted
N, M = map(int, input().split())

ans = 0
if 2 * N == M:
    ans = (2 * N + M) // 4
elif 2 * N > M:
    ans = M // 2
else:
    ans = N
    ans += (M - 2 * N) // 4
print(ans)
# Judge status: Accepted
a, b, k = map(int, input().split())
ans = set()
for i in range(a, min(a+k, b+1)):
    ans.add(i)
for i in range(max(a, b-k+1), b+1):
    ans.add(i)
ans = sorted(ans)
for i in ans:
    print(i)
# Judge status: Wrong Answer
s = input()
A = None
Z = None
for i in range (len(s)):
  if s[i] == 'A':
    A = i
  if s[i] == 'Z':
    Z = i

print(Z-A+1)
# Judge status: Accepted
import math
n, m = map(int, input().split())

ab = []
ans = 0
sum = 0

for _ in range(n):
    ab.append(list(map(int, input().split())))

ab.sort()

for i in range(n):
    if m - ans < ab[i][1]:
        sum += (m-ans) * ab[i][0]
        ans = m
        break
    else:
        ans += ab[i][1]
        sum += ab[i][0] * ab[i][1]

    if ans == m:
        break


print(sum)
# Judge status: Accepted
import sys

input = sys.stdin.readline

def main():
    ans = 0
    S = input().rstrip('\n')
    p = t = ''
    for i in S:
        p += i
        if t != p:
            ans += 1
            p, t = '', p 
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,q = map(int,input().split())
s = input()

array = [0]*len(s)

for i in range(len(s)-1):
  if( s[i-1:i+1] == "AC" ):
    if( i == 0 ):
      array[i] = 1
    else:
      array[i] = array[i-1] + 1
  else:
    if( i == 0 ):
      array[i] = 0
    else:
      array[i] = array[i-1]
      
array[len(s)-1] = array[len(s)-2]

for i in range(q):
  l,r = map(int,input().split())
  l -= 1
  r -= 1
  ans = array[r] - array[l]
  print(ans)
# Judge status: Accepted
a,b,c,k = map(int,input().split())

if a >= k:
    print(k)
elif (a+b) >= k:
    print(a)
else:
    print(a-(k-a-b))
# Judge status: Accepted
INF = 10**12

H, N = map(int, input().split())
magics = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[INF]*(H+1) for _ in range(N+1)]
dp[0][0] = 0
for i, (a, b) in enumerate(magics):
    for j in range(H+1):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        dp[i+1][min(H, j+a)] = min(dp[i+1][min(H, j+a)], dp[i+1][j] + b)
print(dp[N][H])
# Judge status: Wrong Answer
import math

N = int(input())
lis = list(range(1, 10))
start_idx = 0
found = False
while start_idx < len(lis)-1:
    if found:
        break
    idx = start_idx
    for idx in range(len(lis)):
        if lis[start_idx] * lis[idx] == N:
            found = True
    start_idx += 1
if found:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, r = map(int, input().split())
if n >= 10:
    print(r)
else:
    print(100*(10-n)+r)
# Judge status: Accepted
x,y = map(int,input().split())
if x%y==0:
  print(-1)
else:
  print(x)
# Judge status: Accepted
N,X,T=map(int,input().split())
if N%X==0:
    ans=N//X*T
else:
    ans=(N//X+1)*T
print(ans)
# Judge status: Accepted
s = input()
n = len(s)

bef = s[0]
key = 0
ans = 1
for i in range(1, n):
  if key == i:
    continue
  if bef == s[i]:
    if i == n-1:
      continue
    bef = s[i:i+2]
    ans += 1
    key = i+1
  else:
    bef = s[i]
    ans += 1
print(ans)
# Judge status: Wrong Answer
i = int(input())
print(i % 1000)
# Judge status: Wrong Answer
N=int(input())
S=input()
x=0
ans=[]
for i in S:
  ans.append(x)
  if i=="I":
    x+=1
  elif i=="D":
    x-=1
print(max(ans))
# Judge status: Accepted
N = int(input())
AB = []
for i in range(N):
    AB.append(list(map(int,input().split())))

A = []
B = []
for i in range(N):
    A.append(AB[i][0])
    B.append(AB[i][1])
A.sort()
B.sort()
if N%2==0:
    A1 = A[N//2-1]
    A2 = A[N//2]
    B1 = B[N//2-1]
    B2 = B[N//2]
    print((B1+B2)-(A1+A2)+1)
else:
    A1 = A[N//2]
    B1 = B[N//2]
    print((B1-A1)+1)
# Judge status: Accepted
MOD = 998244353

n = int(input())
d_lst = list(map(int, input().split()))
if d_lst[0] != 0:
    print(0)
    exit()

max_d = max(d_lst)
lst = [0 for _ in range(max_d + 1)]
for d in d_lst:
    lst[d] += 1
if lst[0] != 1:
    print(0)
    exit()
ans = 1
for i in range(max_d):
    ans *= pow(lst[i], lst[i + 1], MOD)
    ans %= MOD
print(ans)
# Judge status: Accepted
a,b,k = map(int, input().split())
left_n = a+k if a+k-1<=b else b+1
right_n = b-k+1 if b-k+1>=a else a

left = [i for i in range(a, left_n)]
right = [i for i in range(right_n, b+1)]

print(*sorted(set(left+right)), sep='\n')
# Judge status: Wrong Answer
lst=[]
c=0
flag=0
n = int(input())
str = input()
lst = str.split(' ')
#for i in range(0,n):
#  lst[i] = int(lst[i])
lst.sort()
#print(lst)
for i in range(0,n):
  flag=0
  if i+1<n:
    if int(lst[i+1])==int(lst[i]):
      flag=1
  for j in range(0,i):
    
    if  int(lst[i])%int(lst[j])==0:
      flag=1
      j=i
  if flag==0:
    c = c+1
print(c)
# Judge status: Accepted
N, M = map(int, input().split())
a_set = set()
b_set = set()
for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        a_set.add(b)
    if b == N:
        b_set.add(a)

# print('a_set, b_set', a_set, b_set)
product = a_set & b_set
if len(product) != 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
mod = 10 ** 9 + 7

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

s = sum(a) 

ans = 0

for i in a:
    s -= i
    s %= mod
    ans += i * s
    ans %= mod

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

checked = {}


def check_attack(h):
    if h == 1:
        checked[h] = 1
        return 1
    elif h in checked:
        return checked[h]
    else:
        k = 1 + 2 * check_attack(h//2)
        checked[h] = k
        return k

print(check_attack(h))
# Judge status: Accepted
import time
K=int(input())
mod=7%K

if 7%K==0:
  print(1)
  exit()
ans=1
now=time.time()
while 1:
  ans+=1
  mod=(mod*10+7)%K
  if mod==0:
    print(ans)
    break
  if time.time()-now>=1.8:
    print(-1)
    break
# Judge status: Accepted
n,m = map(int,input().split())
a = map(int,input().split())
x = n-sum(a) 
if x >= 0:
    print(x)
else:
    print(-1)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if b - a == c - b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A, B, K = [int(x) for x in input().split()]
if K <= A:
    print(A - K, B)
else:
    print(0, max(0, A + B - K))
# Judge status: Accepted
n,*a = map(int,open(0).read().split())
pm = sum(a)
e = 1
te = 1
for i in a:
  pm -= i
  e = min((e-i)*2,pm)
  te += e
  if e < 0:
    break
if e < 0:
  print(-1)
else:
  print(te)
# Judge status: Accepted
A,B,C = map(int,input().split())
K = int(input())

ans = 0
while B<=A:
    ans += 1
    B *= 2

while C<=B:
    ans += 1
    C *= 2

print("Yes" if ans <= K else "No")
# Judge status: Accepted
S=input()
T=input()
ans=0
for i in range(len(S)):
    if S[i]!=T[i]:
        ans+=1
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
if m>=2*n:
    p = n+(m-2*n)//4
else:
    p = m//2
print(p)
# Judge status: Accepted
import copy
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_max = max(a)
n_ = sum(x == a_max for x in a)
if n_ > 1:
    a_max_2 = a_max
    for _ in range(n):
        print(a_max)
else:
    #a_max_2=sorted(set(a))[-2]
    b = copy.copy(a)
    b.remove(a_max)
    a_max_2 = max(b)
    for i in a:
        if i == a_max:
            print(a_max_2)
        else:
            print(a_max)
# Judge status: Accepted
N = int(input())
S = set([input() for _ in range(N)])
print(len(S))
# Judge status: Accepted
a,b,t=map(int, input().split())
print(b*((t//a)))
# Judge status: Accepted
n=int(input())
x=list(map(int,input().split()))
y=sorted(x)
L=y[n//2-1]
R=y[n//2]
for i in range(n):
    if x[i]<=L:
        print(R)
    else:
        print(L)
# Judge status: Accepted
K, S = map(int, input().split())

ans = 0
for x in range(K+1):
    for y in range (K+1):
        if  0 <= S - x- y <= K:
            ans +=1

print(ans)
# Judge status: Accepted
N = int(input())
for f in range(0,26):
    for s in range(0,15):
        if (4*f)+(7*s)==N:
            print('Yes')
            break
        elif (f==25) and (s==14):
            print('No')
    else:
        continue
    break
# Judge status: Wrong Answer
x,y,z = map(int, input().split())
print((x-1)//(y+z))
# Judge status: Wrong Answer
s = int(input())
if s == 25:
    print("Christmas")
elif s == 24:
    print("Christmas Eve")
elif s == 23:
    print("Christmas Eve Eve")
elif s == 22:
    print("Chrsitmas Eve Eve Eve")
# Judge status: Wrong Answer
S = input ()
Z = ''.join(list(S))
Z = Z.replace('0B', '')
Z = Z.replace('1B', '')
Z = Z.replace('B', '')
print (Z)
# Judge status: Accepted
n,m=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(m)]
l2=sorted(l,key=lambda x:x[1])
d=dict()
for p,y in l2:
    if not p in d.keys():
        d[p]=dict()
    d[p][y]=len(d[p])+1
for p,y in l:
    print('{}'.format(p).zfill(6)+'{}'.format(d[p][y]).zfill(6))
# Judge status: Accepted
a,b,x=map(int,input().split())
if a <= x <= a+b:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
N = int(input())

robos = []
for i in range(N):
    x, l = map(int, input().split())
    robos.append((x, l))

robos.sort()

kosuu = 0
maenomigi = -100000000000000000000000
for x, l in robos:
    # ok
    if maenomigi <= x - l:
        maenomigi = x + l
        kosuu += 1

print(kosuu)
# Judge status: Wrong Answer
N,M=map(int,input().split())
a=input().split()

scm=[]
for x in range(1,M+1):
    for _a in a: 
        p=x/int(_a)-0.5
        if not(p > 0 and p%1==0):
            break
    else:
        scm.append(x)
        if len(scm)>1:
            break
if len(scm)!=0:
    d=abs(scm[0]-scm[1])
    print(len(range(min(scm),M+1,d)))
else:
    print(0)
# Judge status: Accepted
n,k=map(int,input().split())
p=[int(i)+1 for i in input().split()]

num=sum(p[:k])
ans=num
for i in range(n-k):
  tmp=p[i+k]-p[i]
  num+=tmp
  if ans<num:
    ans=num

print(ans/2)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
 
ans = 1
u = False
d = False
for i in range(1, n):
    if u:
        if a[i] < a[i - 1]:
            u = False
            ans += 1
    elif d:
        if a[i] > a[i - 1]:
            d = False
            ans += 1
    else:
        if a[i] > a[i - 1]:
            u = True
        elif a[i] < a[i - 1]:
            d = True
print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
print('Possible' if (a+b)%3==0 else 'Impossible')
# Judge status: Accepted
n, k = map(int, input().split())
d = set(map(int, input().split()))
ok = set(range(10))
ans = 0
for i in range(n, 100000):
    ans = i
    flag = False
    while i != 0:
        if i % 10 in d:
            flag = True
            break
        i = i // 10
    if not flag:
        print(ans)
        break
# Judge status: Accepted
def solve():
    n, x = map(int, input().split())
    s = list(map(int, input().split()))
    cnt, tmp, prv = 0, 0, 0

    if s[0] > x:
        cnt += s[0] - x
        s[0] = x

    for y in s:
        if prv + y > x:
            tmp = prv + y - x
            cnt += tmp
            prv = y - tmp
        else:
            prv = y
    print(cnt)


solve()
# Judge status: Accepted
N = int(input())
l = [(int(input())-1) for _ in range(N)]
flag = [0]*N
flag[0] = 1
flag[1] = 2
cnt = 0
cur_b = 0
while True:
    cnt += 1
    next_b = l[cur_b]
    if flag[next_b] == 1:
        print(-1)
        break
    elif flag[next_b] == 2:
        print(cnt)
        break
    else:
        flag[next_b] = 1
        cur_b = next_b
else:print(-1)
# Judge status: Wrong Answer
S = list(map(int,list(input())))
K = int(input())
if sum(S[:K]) == K:
    print('1')
else:
    for s in S:
        if s == 1:
            continue
        else:
            print(s)
            break
# Judge status: Accepted
N, K = map(int, input().split())
ans = 0

def num(i):
    j = 0
    while i < K:
        i *= 2
        j += 1
    return j

for i in range(1, N+1):
    ans += float(1) / (N*2**num(i))
print(ans)
# Judge status: Accepted
def main():
    x = int(input())
    print(10 - x // 200)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a = list(map(int,input().split()))
a.sort()
count= 0
sum = a[2]-a[1]

for i in range(a[2]-a[1]):
  a[1] += 1
  a[0] += 1
  
for i in range(10**12):
  a[0] += 2
  count += 1
  if a[0] >= a[1]:
    break

if a[0] == a[1]:
  print(sum + count)
elif a[0] > a[1]:
  print(sum + count + 1)
# Judge status: Wrong Answer
n,t=map(int,input().split())
be=1001
ans=""
for _ in range(n):
  c,time=map(int,input().split())
  if time<=t:
    be=min(be,time)
    ans=c
if be==1001:
    print("TLE")
else:
    print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(input().split())
ans=0
for i in range(n,100001):
  cnt=list(str(i))
  for j in range(len(cnt)):
    if cnt[j] in a:
      ans=1
      break
  if ans==0:
    print(i)
    exit()
  else:
    ans=0
    continue
# Judge status: Accepted
# -*- coding: utf-8 -*-

X, Y, Z = map(int, input().split())

used_space = Y + (Z * 2)
ans = 0

while True:
    if used_space > X:
        break
    used_space = used_space + Y + Z
    ans += 1

print(ans)
# Judge status: Wrong Answer
from fractions import gcd
import sys
input = sys.stdin.readline

n = int(input())
ans = 1
for _ in range(n):
    t = int(input())
    ans *= int(t/gcd(ans, t))
print(ans)
# Judge status: Accepted
S = input()
 
# S_0 = S_1 かつ S_2 = S_3
# S_0 = S_2 かつ S_1 = S_3
# S_0 = S_3 かつ S_1 = S_2
# S_0 = S_1 = S_2 = S_3 を除外

if S[0] == S[1] == S[2] == S[3]: print('No')
else:
  if (S[0] == S[1] and S[2] == S[3]) or (S[0] == S[2] and S[1] == S[3]) or (S[0] == S[3] and S[1] == S[2]): print('Yes')
  else: print('No')
# Judge status: Accepted
s = list(input())
if s[-1] == "s":
  s.append("es")
else:
  s.append("s")
S = "".join(s)
print(S)
# Judge status: Accepted
a, b = map(int, input().split())
print('Yes' if a is b else 'No')
# Judge status: Accepted
N = int(input())
H = list(map(int,input().split()))

#height = H[0]
index = 0
maximum = 0
for i in range(1,N):
    if H[i-1] < H[i]:
        maximum = max(maximum,i-1-index)
        index = i 
    elif i == N-1:
        maximum = max(maximum,i-index)
print(maximum)
# Judge status: Accepted
l = list(input())
n = len(l)

ans = 0
for i in reversed(range(n)):
    if l[i] == '?':
        if not i==0:
            if l[i-1]=="P":
                l[i] = "D"
                continue
        if not i==n-1:
            if l[i+1] == "D":
                l[i] = "P"
                continue
        l[i] = "D"
        
print("".join(l))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

set_a = list(set(a))

if( len(a) == len(set_a)):
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
a,b,c = map(int, raw_input().split())
print max(10*a + b, 10*b + c)
# Judge status: Accepted
N = int(input())
Ls,L = [],[]
for i in range(N):
    A = int(input())
    if A==0:
        Ls.append(L)
        L = []
    else:
        L.append(A)
Ls.append(L)
out = 0
for L in Ls:
    out += sum(L)//2
print(out)
# Judge status: Accepted
N=int(input())
S=input()
a=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
ans=''
for i in (S):
  num=a.index(i)+N
  if(num>25):
    num-=26
  ans+=a[num]
print(ans)
# Judge status: Wrong Answer
x = list(input())
while x[0:int(len(x)/2)] != ['T'] * int(len(x)/2):
    for i in range(len(x)-1):
        if x[i] == 'S' and x[i+1] == 'T':
            x[i], x[i+1] = '', ''
    x.remove('')
print(len(x))
# Judge status: Accepted
n, m = map(int, input().split())
 
sac = set()
lwa = [0] * n
 
for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if p in sac:
        continue
    elif s == 'AC':
        sac.add(p)
    else:
        lwa[p] += 1

print(len(sac), sum(lwa[p] for p in sac))
# Judge status: Wrong Answer
a, b = map(int, input().split())

def answer(a: int, b: int) -> str:
    if (a * b) % 2 != 0:
        return 'Even'
    else:
        return 'Odd'

print(answer(a, b))
# Judge status: Accepted
N,K=map(int,input().split())
P=list(int(x) for x in input().split())
list.sort(P)
sum=0
for i in range(K):
	sum+=P[i]
print(sum)
# Judge status: Accepted
A, B, C = map(int,input().split())

if B >= C >= A:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
K=int(input())
A = [[] for j in [0]*(10**5)]
A[0]=[1,2,3,4,5,6,7,8,9]
B=9
C=0
while B<=K:
 for i in range(len(A[C])):
  if A[C][i]%10>0:
   A[C+1].append(A[C][i]*10+(A[C][i]%10)-1)
  A[C+1].append(A[C][i]*10+(A[C][i]%10))
  if A[C][i]%10<9:
   A[C+1].append(A[C][i]*10+(A[C][i]%10)+1)
 B+=len(A[C+1])
 C+=1
print(A[C][len(A[C])-B+K-1])
# Judge status: Accepted
A,B,K = map(int,input().split())

def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

print(cf(A,B)[-(K)])
# Judge status: Wrong Answer
X,Y=map(int,input().split())
import math
print(int(math.log2(Y/X))+1)
# Judge status: Accepted
# coding: utf-8

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

mini = N + 1
cnt = 0
for p in P:
    if p <= mini:
        mini = p
        cnt += 1

print(cnt)
# Judge status: Accepted
import sys
from bisect import bisect_right, bisect_left
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = list(int(readline()) for _ in range(N))

    LIS = [INF]*N
    A.reverse()
    for a in A:
        i = bisect_right(LIS,a)
        LIS[i] = a
    print(bisect_left(LIS, INF))


if __name__ == '__main__':
    main()
# Judge status: Accepted
A, B, K = map(int, input().split())

ans1 = list(range(A, B + 1)[:K])
ans2 = list(range(A, B + 1)[-K:])
for i in sorted(set(ans1 + ans2)):
    print(i)
# Judge status: Accepted
A = list(map(int, input().split()))
A.sort()
print(A[0]+A[1]+10*A[2])
# Judge status: Accepted
s = input()

if s[2] == s[3] and s[4] == s[5]:
	print('Yes')
else:
	print('No')
# Judge status: Accepted
n = int(input())
d = {}

for i in range(n):
  temp = "key" + input()
  if temp in d:
    del d[temp]

  else:
    d[temp] = 1

ans = 0
for i in d:
  ans += d[i]
  
print(ans)
# Judge status: Accepted
N = int(input())

keta = len(str(N))
cnt = 0

for i in range(1,keta,2):
    cnt += 9 * (10**(i-1))

if keta % 2 == 1:
    cnt += N - (10**(keta-1)) + 1

print(cnt)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
ans = []
N = 0
b = ""
for i in a:
  if b == "":
    b = i
    N += 1
  elif b == i:
    N += 1
  else:
    if N >= 4:
      print(b**2)
      exit()
    elif N >= 2:
      ans.append(b)
    b,N = i, 1
  if len(ans) == 2: break
if N >= 2: ans.append(b)
print(ans[0]*ans[1] if ans else 0)
# Judge status: Wrong Answer
a = list(map(int, input().split()))

print(a.index(0))
# Judge status: Wrong Answer
import bisect
H,N = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]
dp = [[10**18]*10**5 for _ in range(N+1)]
for i in range(N+1):
  dp[i][0]=0
mi=10**9
for i in range(N):
  for w in range(10**5):
    dp[i+1][w]=min(dp[i+1][w],dp[i][w])
    if w-AB[i][1]>=0:
      dp[i+1][w]=min(dp[i+1][w],dp[i + 1][w - AB[i][0]] + AB[i][1])
for i in range(H,10**5):
  mi = min(mi,dp[N][i])
print(mi)
# Judge status: Accepted
n=int(input())
a=list(map(lambda x:1 if "#"==x else 0,list(input())))
mn=n-sum(a)
s=mn
for i in a:
  if i:
    s+=1
  else:
    s-=1
  mn=min(mn,s)
print(mn)
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = []
b = []
for _ in range(n):
    a.append(list(input()))
for _ in range(m):
    b.append(list(input()))

c = n - m + 1
for i in range(c):
    for j in range(c):
        flag = True
        for p in range(m):
            for q in range(m):
                if a[i+p][j+q] != b[p][q]:
                    flag = False
        if flag == True:
            break
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()
from decimal import *

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


a = Decimal(a).sqrt()
b = Decimal(b).sqrt()
c = Decimal(c).sqrt()

if a + b < c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
A = map(int,input().split())
 
ans = 1
for num in A:
	ans*=num
    
if (ans > 10^18):
    ans = -1
print(ans)
# Judge status: Accepted
import math
n = int(input())
print(math.floor((n+1)/2))
# Judge status: Accepted
from itertools import groupby, accumulate, product, permutations, combinations
from collections import Counter
def solve():
    N = int(input())
    dics = [[0]*N for _ in range(26)]
    S = [input() for _ in range(N)]
    for i in range(N):
        for s in S[i]:
            dics[ord(s)-ord('a')][i]+=1
    ans = ''
    for i in range(26):
        ans += chr(i+ord('a'))*min(dics[i])
    return ans
print(solve())
# Judge status: Accepted
# C - Peaks

N, M = map(int, input().split())
H = list(int(x) for x in input().split())
G = [[] for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

ans = [1] * N

for i in range(N):
    for j in G[i]:
        if H[i] <= H[j]:
            ans[i] = 0
            break

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

print(a,b,c)
# Judge status: Accepted
n = [int(input()) for _ in range(4)]
if n[0]<=n[1]:
    print(n[0]*n[2])
else:
    print((n[1]*n[2])+(n[0]-n[1])*n[3])
# Judge status: Wrong Answer
n = int(input())
t = [0] * 100
for i in range(11, 100):
  msb = i // 10
  lsb = i % 10
  if lsb == 0:
    continue
  for j in range(1, n+1):
    if j % 10 == lsb and int(str(j)[0]) == msb:
      t[i] += 1

ans = 0
for i in range(11, 100):
  msb = i // 10
  lsb = i % 10
  if lsb == 0:
    continue
  if msb == lsb:
    ans += t[i] * (t[i] - 1) // 2
  else:
    ans += t[i] * t[lsb * 10 + msb]
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
x = 0
for i in range(1000000):
    x += i
    if x > a:
        x 
        break

print(x-a)
# Judge status: Accepted
n, k = map(int, input().split())
dat = list(map(int, input().split()))

dat2 = []
m = -1
#print(dat[:k])
n = sum(dat[:k])
dat2.append(n)
m = n
mind = 0
for i in range(1, len(dat) - k ):
    #print("in/out")
    #print(dat[k+i])
    #print(dat[i])
    n += dat[k+i]
    n -= dat[i]
    dat2.append(n)
    if n > m:
        m = n
        mind = i + 1


#print(dat2)
#print(m)
#print(mind)

r = 0
for i in range(mind, mind + k):

    r += (dat[i] + 1) / 2

print(r)
# Judge status: Accepted
N = int(input())
a = []
a = input().split(' ')
a = [int(i) for i in a]
a = sorted(a, reverse=True)
Alice = 0
Bob = 0
for i in range(N):
  if i == 0:
    Alice += a[i]
  elif i%2 == 0:
    Alice += a[i]
  elif i%2 == 1:
    Bob += a[i]

print(Alice - Bob)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans=100000
for i in range(-100,101):
    tmp=0
    for j in range(n):
        tmp+=(a[j]-i)**2
    if tmp<ans:
        ans=tmp
print(ans)