peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n, h = map(int,input().split())
a = []
b = []
ans = 0

for i in range(n):
    x, y = map(int,input().split())
    a.append(x)
    b.append(y)

b.sort(reverse=True)
c = max(a)

#刀を投げる
for i in b:
    if i > c:
        h -= i
        ans += 1
        if h <= 0:
            print(ans)
            exit()

#刀を振る
ans += (h+c-1)//c
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = []
B = []
ans = 0
for _ in range(N):
    a, b = map(int, input().split())
    ans += b - a
    A.append(a)
    B.append(b)

# AB = [[int(x) for x in input().split()] for _ in range(N)]

if N % 2:
    A.sort()
    B.sort()
    ans = B[N//2] - A[N//2] + 1

else:
    ans += 1
print(ans)
# Judge status: Accepted
H = int(input())
W = int(input())
N = int(input())
mn = max(H,W)
mx = max(H,W)
ans = 0
x = 0
while x<N:
  x += mx
  ans+=1
print(ans)
# Judge status: Accepted
s=input()
List=["eraser","erase","dreamer","dream"]
for item in List:
  s = s.replace(item,'')
if len(s)==0:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
s = input()
d = {}
for letter in s:
  if letter in d:
    d[letter] += 1
  else:
    d[letter] = 1
    
for key in d:
  if d[key] % 2 != 0:
    print("No")
print("Yes")
# Judge status: Wrong Answer
H,A=map(int,input().split())

print((H+1)//A+1)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
n=[a,b,c]
d=[]
for i in range(1,len(n)):
  d.append(n[i]+n[i])
print(min(d))
# Judge status: Accepted
# -*- coding: utf-8 -*-
a,b,c,x,y = [int(i) for i in input().split()]

if x <= y:
    ans1 = min(c * x * 2 + b * (y - x), c * y * 2)
    #print('a')
else: #x > y
    ans1 = min(c * y * 2 + a * (x - y), c * x * 2)
    #print('b')
ans2 = a * x + b * y
print(min(ans1, ans2))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
a.sort()
ai=a[-1]
aj=a[0]
for j in range(1,n-1):
    if abs(ai/2-a[j]) < abs(ai/2-aj):
        aj=a[j]
print(ai, aj)
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

list1 = list(map(int,input().split()))

sum = 0

for i in range(M):
    sum += list1[i]

ans = N - sum

if ans < 0:
    ans = -1

print(ans)
# Judge status: Wrong Answer
X = input()
current = None
s = 0
t = 0
ans = 0
for x in X:
    if x == 'S':
        if current != x:
            ans += min(s, t) * 2
            s = t = 0
        s += 1
    else:
        if current != x:
            t = 0
        t += 1
    current = x
ans += min(s, t) * 2
print(len(X) - ans)
# Judge status: Accepted
#python3

def main():
    w, a, b = map(int, input().split())
    x = min(abs(a-b), abs((a+w)-b))
    y = min(abs((b+w)-(a+w)), abs((b+w)-a))
    ans = min(x, y)
    if (a <= b) & (b <= a+w):
        print(0)
    elif (a <= b+w) & (b+w <= a+w):
        print(0)
    else:
        print(ans)
main()
# Judge status: Accepted
x = int(input())

ans=0
y=0
for i in range(1,x+1):
    y=y+i
    ans+=1
    if y>=x:
        print(ans)
        break
# Judge status: Wrong Answer
n=int(input())
List=[1 for x in range(n+1)]
for x in range(2,n+1):
  for y in range(x,n+1,x):
    List[y]+=1
ans=1
for x in range(1,n+1):
  ans+=(List[x]*x)
print(ans)
# Judge status: Wrong Answer
import sys
N = int(input())

ans = 0

if N == 1:
    print(1)
    sys.exit()

for i in range(1, N):
    ans += i
    if ans >= N:
        break

for j in range(1, i+1):
    if ans - N == j:
        continue
    print(j)
# Judge status: Accepted
n = int(input())
c = input()

w = [0]*(n+1)
r = [0]*(n+1)
for i in range(0,n):
  w[i+1] = w[i]
  r[n-i-1] = r[n-i]
  if c[i]=='W':
    w[i+1] += 1
  if c[n-i-1]=='R':
    r[n-i-1] += 1

print(min([w[i]+r[i]-min(w[i],r[i]) for i in range(0,n+1)]))
# Judge status: Accepted
n, m, k = map(int, input().split())

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

a_, b_ = [0], [0]

for i in range(n):
    a_.append(a_[i] + a[i])
for i in range(m):
    b_.append(b_[i] + b[i])

ans = 0
j = m

for i in range(n+1):
    
    if a_[i] > k:
        break
    while b_[j] > k - a_[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
A=[]
B=[]
for i in range(m):
  a,b=map(int,input().split())
  if a==1:
    A.append(b)
  if b==n:
    B.append(a)
if len(set(A) & set(B))>0:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
r = int(input())
r = r*r
print(r)
# Judge status: Accepted
a, b, c = map(int, input().split())

print("win" if (a+b+c) <= 21 else "bust" )
# Judge status: Accepted
A = [int(input()), int(input())]

if 1 not in A:
    print(1)
elif 2 not in A:
    print(2)
else:
    print(3)
# Judge status: Accepted
N = int(input())
sp = [list(input().split())+[i] for i in range(N)]

for i in range(N):
  sp[i][1]=-int(sp[i][1])

sp.sort()

for _,_,i in sp:
  print(i+1)
# Judge status: Wrong Answer
w,h,n = map(int,input().split())
lists = [list(map(int,input().split())) for i in range(n)]
x1 = 0
x2 = w
y1 = 0
y2 = h
for x,y,a in lists:
    if a == 1:
        x1 = max(x1,x)
    elif a == 2:
        x2 = min(x2,x)
    elif a == 3:
        y1 = max(y1,y)
    elif a == 4:
        y2 = min(y2,y)
x = x2 - x1
y = y2 - y1
ans = x * y
if ans <= 0:
    ans = 0
print(ans)
# Judge status: Accepted
N,M = map(int, input().split())

from collections import defaultdict
d = defaultdict(list) 
for i in range(N):
    a,b = map(int, input().split())
    d[a].append(b)

import heapq
q = []
ans = 0
for i in range(1,M+1): #1~MまでOK
    ls = d[i]
    for l in ls:
        heapq.heappush(q,-l)
    if len(q)==0:continue
    a = heapq.heappop(q)
    # print(i,ls,-a)
    ans += a
print(-ans)
# Judge status: Accepted
s = input()
def ki(tap):
    for i in range(0,len(tap),2):
        if tap[i]=='L':
            return 'No'

def gu(tap):
    for i in range(1,len(tap),2):
        if tap[i]=='R':
            return 'No'

if ki(s)=='No' or gu(s)=='No':
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = list(set((map(int, input().split()))))
print(A)
vote = []
for Ai in A:
    if Ai > (1 / (4 * M) * sum(A)):
        vote.append(Ai)
if len(vote) >= M:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())

found = False
for x in range(0, 25+1):
    for y in range(0, 14+1):
        if 4 * x + 7 * y == N:
            found = True
if found:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
nk = input().split()
n , k = int(nk[0]), int(nk[1])
a = [int(i) for i in input().split()]

t = 1
tl = [1]
ts = {1}


for i in range(len(a)):
    
    t = a[t-1]
    if t in ts:
        break
    else:
        tl.append(t)
        ts.add(t)

tl2 = tl[tl.index(t):len(tl)]
         
# print(tl)
# print(tl2)

ans = 0

if k < len(tl):
    ans = tl[k]
else:
    k = k - len(tl)
    j = k % len(tl2)
    ans = tl2[j]

print(ans)
# Judge status: Accepted
N = int(input())
a = ""
if N ==0:
  a =0
while N !=0:
  if N%2 != 0:
    a = "1" + a
  else:
    a = "0" + a
  N = - (N//2)
print(a)
# Judge status: Wrong Answer
N = int(input())
A = []
A.append(list(map(int,input().split())))
A.append(list(map(int,input().split())))
low = 0
ans = 0
for i in range(N):
#  print("low:",low,", i:",i,",A[low][i]:",A[low][i])
  if low == 0:
    ans += A[low][i]
  else:
    ans += A[low][i-1]
  if sum(A[1][i:N-1]) > sum(A[0][i+1:N-1])+A[1][N-1]:
    low = 1
ans += A[1][N-1]
print(ans)
# Judge status: Accepted
s=input()
for i,j in zip(s,s[1:]):
    if i==j:
        print('Bad')
        exit()
print('Good')
# Judge status: Accepted
n,m = map(int,input().split())
X = sorted(list(map(int,input().split())))
d = []
for i in range(len(X)-1):
    d.append(X[i+1]-X[i])
d.sort(reverse=True)
print (sum(d[n-1:]))
# Judge status: Accepted
N = int(input())
A = input().split()
A = [int(A[i])-i for i in range(N)]
A = sorted(A)

s = 0
if N % 2 == 0:
  k = int(N/2)
  for i in range(N):
    s += abs(A[i]-A[k-1])
else:
  k = int((N+1)/2)
  for i in range(N):
    s += abs(A[i]-A[k-1])
print(s)
# Judge status: Accepted
W, H, N = list(map(int, input().split()))
x_low, x_up = 0, W
y_low, y_up = 0, H
for _ in range(N):
    x, y, a = list(map(int, input().split()))
    if a == 1:
        x_low = max(x_low, x)
    elif a == 2:
        x_up = min(x_up, x)
    elif a == 3:
        y_low = max(y_low, y)
    else:
        y_up = min(y_up, y)
print(max(0, x_up - x_low) * max(0, y_up - y_low))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    a[i]-=1
ans=0
for i in range(n-1):
    if a[i]==i and a[i+1]==i+1:
        continue
    if a[i]==i:
        ans+=1
if a[-1]==n-1:
    ans+=1
print(ans)
# Judge status: Accepted
from sys import stdin
import sys
##  input functions for me
def ria(sep = ''):
    if sep == '' :
        return list(map(int, input().split())) 
    else: return list(map(int, input().split(sep)))
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
    A = ri()
    B = ri()
    for i in range(1,4):
        if i != A and i != B: print(i)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
A=[int(input()) for i in range(5)]
k=int(input())
for i in range(5):
    for j in range(i,5):
        if abs(A[i]-A[j])>=k:
            print(":(")
            exit()
print("Yay1")
# Judge status: Wrong Answer
import sys
S = input()
T = input()
lenS = len(S)
lenT = len(T)
ans = ""
for i in range(lenS-lenT-1,-1,-1):
    for j in range(lenT):
        if S[i+j]!=T[j] and S[i+j]!="?":
            break
    else:
        ans = S[:i]+T+S[i+lenT:]
        print(ans)
        sys.exit()
print("UNRESTORABLE")
# Judge status: Accepted
import sys

S = list(sys.stdin.readline().strip())
if len(set(S)) > 1:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())

count = 0
for i in range(0, len(str(N)), 2):
  if N >= 10**(i+1):
    count += 9 * 10**i
  else:
    count += N % 10**i + 1

print(count)
# Judge status: Wrong Answer
S,T = input().split()

print(S+T)
# Judge status: Wrong Answer
try:
    n=list(map(int, input().strip().split()))

    lis1=[]
    for i in range(0,len(n)):
        for a in range(0,len(n)):
            if n[i]!=n[a]:
                z=int(n[a]+n[i])
                lis1.append(str(z))
               
    print(int(min(lis1)))
except:
    print('')
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 11:57:51 2020

@author: shinba
"""

A = list(map(int,input().split()))

B = [[5,5,7],[5,7,5],[7,5,5]]

if A in B:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
n = int(input())
s=input()
r=[]
g=[]
b=[]
for i,c in enumerate(s):
    if 'R' == c:
        r.append(i+1)
    elif 'G' == c:
        g.append(i+1)
    elif 'B' == c:
        b.append(i+1)
print(r,g,b)
count=0
for i in r:
    for j in g:
        for k in b:
            if j*2-i-k != 0:
                count+=1
print(count)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
i = 0
check = 1
satisfy = [False for i in range(n)]
break_block = 0
while i < n:
    if a[i] == check and not satisfy[check - 1]:
        satisfy[check - 1] = True
        check += 1
    else:
        break_block += 1
    i += 1
if not satisfy[0]:
    print(-1)
else:
    print(break_block)
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())
a = list(int(input()) for i in range(n))

ans = 0

for i in range(n):
    ans += a[i]//2

i=0
while i < n-1:
    if a[i] %2==1 and a[i+1]%2==1:
        ans+=1
        i+=1
    elif i<n-2:
        if a[i] %2==1 and a[i+1]%2==0 and a[i+2]%2==1:
            ans+=1
            i+=2
    i+=1

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

if A == 1:
    A += 13
if B == 1:
    B += 13

if A > B:
    print('Alice')
elif A < B:
    print('Bob')
else:
    print('Draw')
# Judge status: Wrong Answer
input()
bs = list(map(int,input().split()))

def f(bs):
        print(bs)
        if bs[0] == 1:
            if len(bs) == 1:
                return 0
            else:
                return int(f([x-1 for x in bs][1:]))
        else:
            return int(1 + f([x for x in bs][1:]))

if 1 not in bs:
    print(-1)
else:
    print(f(bs))
# Judge status: Accepted
import math
n = int(input())
print( math.ceil(n/1000)*1000-n)
# Judge status: Accepted
n,m = map(int, input().split())
yen = [list(map(int, input().split())) for _ in range(n)]
yen.sort(key=lambda x:(x[0]))
ans = 0
hon = 0
for i in range(n):
    if hon + yen[i][1] <= m:
        hon += yen[i][1]
        ans += yen[i][0]*yen[i][1]
    else:
        ans += yen[i][0]*(m-hon)
        hon = m
    if hon == m:
        break
print(ans)
# Judge status: Wrong Answer
import sys
stdin = sys.stdin

mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n, q = na()
s = ns()
ac = []
now = 0
f = False
for si in s:
    if si == "C" and f:
        now += 1
        f = False
    elif si == "A":
        f = True
    else:
        f = False
    ac.append(now)
ac.append(now)
for _ in range(q):
    l, r = na()
    print(ac[r] - ac[l-1])
# Judge status: Accepted
N, K = map(int, input().split())
S = input()

ans = ""
for i, s in enumerate(S):
    if i == K-1:
        ans += s.lower()
    else:
        ans += s
print(ans)
# Judge status: Accepted
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())

dist = abs(A - B)
if dist <= T * (V - W):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
a=input()
print(a[0] ,end="")
print(a[1] ,end="")
print(a[2])
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]


ans = 0
A = Counter(a)

for i in A.keys():
    if i != A[i]:
        ans += min(A[i], abs(A[i]-i))

print(ans)
# Judge status: Wrong Answer
N, R = map(int, input().split())
print(R + 100*(10-N))
# Judge status: Wrong Answer
import collections
import heapq
n,m = map(int,raw_input().split(' '))

elems = [map(int, raw_input().split(' ')) for _ in range(n)]
heap = []
chosen = []

j = 0
cumul = 0
for i in range(1,m+1):

	while(j < len(elems) and elems[j][0] <= i): 
		heapq.heappush(heap,-elems[j][1])
		j+=1
	if heap:
		cumul -= heapq.heappop(heap)

print cumul
# Judge status: Accepted
# C - Snuke Festival

import numpy as np
N = int(input())
A = np.array(list(int(x) for x in input().split()))
B = np.array(list(int(x) for x in input().split()))
C = np.array(list(int(x) for x in input().split()))
A.sort()
C.sort()

ans = np.sum(np.searchsorted(A, B,'left') * (N - np.searchsorted(C, B,'right')))
print(ans)
# Judge status: Accepted

sx, sy, tx, ty = map(int, input().split())

ans = ""

y = (ty - sy) 
x = (tx - sx)

# 一周目
ans += "U" * y
ans += "R" * x
ans += "D" * y
ans += "L" * x

# 二周目
ans += "L"
ans += "U" * (y + 1)
ans += "R" * (x + 1)
ans += "D"
ans += "R"
ans += "D" * (y + 1)
ans += "L" * (x + 1)
ans += "U"

print(ans)
# Judge status: Wrong Answer
N = int(input())
li = [list(map(int, input().split())) for i in range(N - 1)]

for n in range(N):
  if n == N - 1:
    print(0)
    break
  
  ans = 0
  for index, i in enumerate(li):
    if index < n:
      continue

    if ans < i[1]:
      ans = i[1]
    else:
      if (ans - i[1]) % i[2] != 0:
        ans += (ans % i[1]) % i[2]

    ans += i[0]
  print(ans)
# Judge status: Accepted
N = input()
if(N.lower() == N):
  print("a")
else:
  print("A")
# Judge status: Accepted
X=int(input())
p=[3,5,7]
if X in p:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

con = 0
state = "FLAT"

for i in range(0,N - 1):
  if state == "FLAT":
    if A[i + 1] > A[i]:
      state = "INCREASE"
    elif A[i + 1] < A[i]:
      state = "DECREASE"
  elif state == "INCREASE":
    if A[i + 1] < A[i]:
      con += 1
      state = "FLAT"
  elif state == "DECREASE":
    if A[i + 1] > A[i]:
      con += 1
      state = "FLAT"
  
      
print(con + 1)
# Judge status: Accepted
n = int(input())
w = [input() for i in range(n)]
ok = "Yes"
e = w[0][-1]
double = [w[0]]
for i in range(1, n):
    if double.count(w[i]) != 0:
        ok = "No"
        break
    double.append(w[i])
    s = w[i][0]
    if s != e:
        ok = "No"
        break
    e = w[i][-1]
print(ok)
# Judge status: Accepted
x=int(input())
ans,k,i=0,1,0
while 1:
    ans+=k
    if ans>=x:
        break
    k+=1
print(k)
# Judge status: Wrong Answer
N,M=map(int,input().split())
X=sorted([int(i) for i in input().split()])
print(sum(sorted([X[i+1]-X[i] for i in range(~-M)])[:M-N]))
# Judge status: Accepted
n,m = map(int,input().split())
if n*2 >= m:
    print(m//2)
else:
    print((m+2*n)//2//2)
# Judge status: Accepted
X = [int(i) for i in input().split()]
print(X.index(0)+1)
# Judge status: Accepted
# Minor Change
S = input()
T = input()
ans = 0
for e in zip(S,T):
    ans += [0,1][e[0]!=e[1]]
print(ans)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

lis = [a,b,c,d,e]
lis2 = [999]*5
for i in range(5):
  if lis[i]%10==0:
    lis2[i] = 10
  else:
    lis2[i] = lis[i]%10

last = lis2.index(min(lis2))
total = 0
for i in range(5):
  if i ==last:
    total += lis[i]
  else:
    total += -(-lis[i]//10)*10
    
print(total)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
s=0
a.reverse()
s=sum(a[:n:2])-sum(a[1:n:2])
print(abs(s))
# Judge status: Accepted
k, a, b = map(int, input().split())
if 2 >= b - a or k+1 <= a:
    print(k+1)
else:
    i = -(a-k-1)//2
    ans = k+1 -a*i + b*i -2*i
    print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
count = 0
ans, mina = a[0], a[0]
flag = False
for i in range(1, n):
    ans += abs(a[i])
    mina = min(mina, abs(a[i]))
    if a[i]<0: count += 1
if count%2 or a.count(0): print(ans-mina*2)
else: print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
import math
print(math.ceil(math.log(n,k)))
# Judge status: Accepted
S = input()
T = input()

ans = 10 ** 5

sl = len(S)
tl = len(T)

for i in range(sl-tl+1):
    cnt = 0
    for j in range(tl):
        if S[i+j] == T[j]:
            continue
        cnt += 1
    ans = min(ans, cnt)

print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))
 
mmin = sum(A) / (4*M)
A.sort(reverse=True)
 
if A[M-1] < mmin:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
A, B = map(int, input().split())
S = input()

a = S[:A]
c = S[A]
b = S[A:]

try:
    a = int(a)
    b = int(b)
    if c == '-':
        print('Yes')
    else:
        print('No')
except:
    print('No')
# Judge status: Accepted
n = int(input())
s = input()
x = 0
y = 0
for i in range(n):
    if s[i] == 'I':
        y += 1
    else:
        y -= 1
    if y > x:
        x = y
print(x)
# Judge status: Accepted
N = int(input())
st = set()
s = 0
n = 1
while s < N:
    st.add(n)
    s += n
    n += 1
if s > N:
    st.remove(s-N)
print(*st, sep='\n')
# Judge status: Wrong Answer
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
m = 0
for i in range(n):
  if a[i] == 1:
    m = i
    break
print(math.ceil(i/(k-1))+math.ceil((n-i)/(k-1)))
# Judge status: Accepted
D,N=map(int,input().split());print(100**D*[N,101][N>99])
# Judge status: Accepted
import math
n = int(input())
m = math.ceil(n/2)
print(m)
# Judge status: Accepted
s = input()

for i, s_i in enumerate(s):
    index = i + 1
    if index % 2 == 0:
        if s_i in 'LUD':
            continue
        else:
            print('No')
            break
    else:
        if s_i in 'RUD':
            continue
        else:
            print('No')
            break
else:
    print('Yes')
# Judge status: Wrong Answer


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

a_list = [i for i in range(1,a+1)]
b_list = [i for i in range(1,b+1)]


a_len = len(a_list)
b_len = len(b_list)


if a_len <= b_len:
    print(a_len)
elif a_len == b_len:
    print(a_len)

elif a_len>=b_len:
    ans = a_len-b_len
    print(ans)
# Judge status: Accepted
from collections import deque
S = input()
S = deque(S)

Q = int(input())
flipped = False
for _ in range(Q):
    q = input().split()
    if q[0] == '1':
        flipped = not flipped
    elif (q[1] == '1') == flipped:
        S.append(q[2])
    else:
        S.appendleft(q[2])

print(''.join(reversed(S)) if flipped else ''.join(S))
# Judge status: Accepted
val = input()
vals = list(val)

sum=0
for v in vals:
  sum += int(v)
  
print(sum)
# Judge status: Wrong Answer
n=int(input())
a=[int(input()) for i in range(n)]
a=sorted(a)
ans=[]
prev_a=a.pop()
num=1
for i in range(n-1):
    current_a = a.pop()
    if prev_a == current_a:
        num+=1
    else:
        if num%2!=0:
            ans.append(current_a)
        if len(a)==0:
            ans.append(current_a)
        num=1
    prev_a=current_a
print(len(ans))
# Judge status: Accepted
X = int(input())
a = 0
b = 1
while  a < X:
    a += b
    b += 1
print(b-1)
# Judge status: Wrong Answer
n = int(input())
ai = [int(input()) for i in range(n)]

ans = 0
nokori = 0

for i in range(1,n):
    ans += ai[i] // 2
    if ai[i] % 2 == 1:
        if ai[i-1] == 1:
            ans += 1
        else:
            ai[i] = 1

print(ans)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):

      if i*500 + j*100 + k*50 == x:
        cnt += 1

print(cnt)
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
hpmin = (100 ** 2) * 100
for p in range(1, 101):
    hp = 0
    for j in range(n):
        hp += (x[j] - p) ** 2
    if hp < hpmin:
        hpmin = hp
print(hpmin)
# Judge status: Accepted
a, b = map(int, input().split())
if (a*b) % 2 == 0:
    print("Even")
else:
    print("Odd")
# Judge status: Accepted
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
lastd = [0] * 26

for i in range(d):
    ans = 0
    tmp = 0
    for j in range(26):
        if tmp < s[i][j] + (i - lastd[j] + 1) * c[j]:
            tmp = s[i][j] + (i - lastd[j] + 1) * c[j]
            ans = j + 1
    lastd[ans - 1] = i
    print(ans)
# Judge status: Accepted
N = map(int, input())
A = list(map(int ,input().split(' ')))
print('YES') if len(set(A))==len(A) else print('NO')
# Judge status: Accepted
n, x = map(int, input().split())
l = list(map(int, input().split()))

cnt = 1
position = 0

for i in range(n):
    position += l[i]
    if position <= x:
            cnt += 1
    else:
            break
print(cnt)
# Judge status: Wrong Answer
from collections import Counter

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

aa = Counter(a)
ans = 0

if len(aa) > k:
	value = sorted(aa.values())
	ans = sum(value[:k-len(aa)-1])

print(ans)
# Judge status: Wrong Answer
s = sorted(list(input()))
t = sorted(list(input()))
if s == t:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
box = [0]*(N+1)
for i in range(N) :
    box[A[i]] += 1

x = list(map(lambda x: x*(x-1)//2 , box))
ans = sum(x)
for j in range(N) :
    print(ans-(box[A[j]] - 1))
# Judge status: Wrong Answer
S=input()
max_v =0
v =0
for i in S:
  if i=="I":
    v+=1
    if v>max_v:
      max_v=v
  else:
    v-=1
# Judge status: Accepted
n, m = map(int, input().split())
if n == m == 1:
    print(1)
elif n == 1 or m == 1:
    print(max(n, m)-2)
else:
    print((m-2)*(n-2))
# Judge status: Wrong Answer
integer = int(input())
for i in range(9):
    for j in range(9):
        if (i + 1) * (j + 1) == integer:
            print('Yes')
            break
else:
    print('No')
# Judge status: Accepted
a,b= map(int, input().split())
min = 1000000000000000000000000000000


if a <= b:
  while min > abs(a-b):
    min = abs(a-b)
    a   =abs(a-b)
else :
  a = a%b
  while min > abs(a-b):
    min = abs(a-b)
    a   = abs(a-b)
  
print(min)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
a = 0
for i in range(1, n-1):
    if (p[i-1] < p[i] < p[i+1]) or (p[i+1] < p[i] < p[i-1]):
        a += 1
print(a)