peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
# coding: utf-8
n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
p.sort()
for i in range(k):
    ans = ans + p[i]
print(ans)
# Judge status: Wrong Answer
n = int(input())
s = [int(input()) for _ in range(n)]
s.sort(reverse=True)
tots = sum(s)
i = n - 1
while tots % 10 == 0:
   tots -= s[i]
   i -= 1
   if i < 0:
      break

print(tots)
# Judge status: Accepted
X = int(input())
print(1000 * (X // 500) + 5 * ((X - 500 * (X // 500)) // 5))
# Judge status: Accepted
i=int(input())
a=0
for j in range(361):
    a=(i+a)%360
    if a==0:
        print(j+1)
        break
# Judge status: Accepted
s=input()
leng=len(s)
cnt1=cnt2=0
m=["0","1"]
for i in range(leng):
    if s[i]!=m[0]:
        cnt1+=1
    else:
        cnt2+=1
    t=m[0]
    m[0]=m[1]
    m[1]=t
print(min(cnt1,cnt2))
# Judge status: Accepted
import math

N, M = map(int, input().split())
if N == M:
    ans = (math.factorial(N) ** 2) * 2
elif abs(N - M) == 1:
    x = max(N, M)
    ans = (math.factorial(x) ** 2) // x
else:
    ans = 0
print(ans % (10 ** 9 + 7))
# Judge status: Wrong Answer
a=3
print(a+a*+a*3)
# Judge status: Accepted
print('A' if ord(input()) < 96 else 'a')
# Judge status: Accepted
s = list(input())
s = set(s)
s = sorted(s)
m = 'abcdefghijklmnopqrstuvwxyz'

for i in range(len(m)):
    if s[i] != m[i]:
        print(m[i])
        exit(0)

    if i + 1 != len(m) and i + 1 == len(s):
        print(m[i + 1])
        exit(0)

print('None')
# Judge status: Accepted
n, k = map(int, input().split())
A = list(map(int, input().split()))

if (n-k)//(k-1) == (n-k)/(k-1):
    print((n-k)//(k-1)+1)
else :
    print((n-k)//(k-1)+2)
# Judge status: Accepted
cnt = 0
for i in range(1, int(input())+1):
    if len(str(i)) % 2:
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
n = int(input())
if n == 1:
  print(1)
elif n%2 == 0:
  print((n//2)/n)
else:
  print(0.6)
# Judge status: Accepted
time = list(map(int, input().split()))
time.sort()
print(sum(time[:2]))
# Judge status: Accepted
N, Y = map(int, input().split())

ans = [-1, -1, -1]
findit = False
sen = 0
for man in range(N + 1):
    if findit == True:
        break
    for gosen in range(N + 1):
        if findit == True:
            break
        sen = N - man - gosen
        if (man * 10000) + (gosen * 5000) + (sen * 1000) == Y and 0 <= sen:
            ans = [man, gosen, sen]
            findit = True

str_ans = map(str, ans)
print(" ".join(str_ans))
# Judge status: Wrong Answer
a = int(input())
s = input()

if a >= 3200:
    print('red')
else:
    print(s)
# Judge status: Wrong Answer
n,m=list(map(int,input().split()))
a=set(input()[1:])
for i in range(n-1):
  b=set(input()[1:])
  a=set(a&b)
print(len(a)-1)
# Judge status: Accepted
n=int(input())
ci=[0]*8
ov=0
a=list(map(int,input().split()))
for pt in a:
  if pt>=3200:
    ov+=1
  else:
    ci[pt//400]=1
ans = sum(ci)
print(max(1,ans),ans+ov)
# Judge status: Wrong Answer
#!/usr/bin/env python3
def main():
    N = int(input())

    ans = 0
    for i in range(N + 1):
        if i % 3 != 0 and i % 5 != 0:
            ans += i
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
ans = float("inf")
for i in range(1, N):
    ans = min(ans, sum([int(n) for n in list(str(i))]
                       )+sum([int(n) for n in list(str(N-i))]))

print(ans)
# Judge status: Accepted
n = int(input())
ans = n // 500 * 1000
n %= 500
ans += n // 5 * 5
print(ans)
# Judge status: Wrong Answer
lst = input()
lst = lst.split()


for i in range(len(lst)):
    lst[i]= int(lst[i])
N = lst[0]
L = lst[1]
q = L
l = 0
lste = [abs(L)]
tlst = []
for i in range(2,N+1):
    t = L+i-1
    q += t
    tlst.append(t)
    t = abs(t)
    lste.append(t)


slst = sorted(lste)
l = slst[0]
if tlst.count(-l) > 0:
    print(q+l)
else:
    print(q-1)
# Judge status: Wrong Answer
import sys
a,b,c,d=map(int,input().split())
if max(a,b)>=0 and max(c,d)>=0:
    print(max(a,b)*max(c,d))
    sys.exit()
elif max(a,b)<=0 and max(c,d)<=0:
    print(min(a,b)*min(c,d))
    sys.exit()
elif max(a,b)>=0 and max(c,d)<=0:
    print(min(a,b)*max(c,d))
    sys.exit()
elif max(a,b)<=0 and max(c,d)>=0:
    print(max(a,b)*min(c,d))
    sys.exit()
else:
    pass
# Judge status: Accepted
x, y = [int(w) for w in input().split()]

ans = 0
t = x
while t <= y:
    t *= 2
    ans += 1
print(ans)
# Judge status: Accepted
from collections import defaultdict
n = int(input())
restaurants = defaultdict(list)
for i in range(n):
    s, p = input().split()
    p = int(p)
    restaurants[s].append([p, i])

cnt = 0
for k, v in sorted(restaurants.items(), key=lambda x: x[0]):
    for p, i in sorted(v, key=lambda x: -x[0]):
        print(i + 1)
# Judge status: Accepted
def run():
  H, N = map(int, input().split())
  ab_li = [tuple(map(int, input().split())) for n in range(N)]
  dp = [0]*(H+1)
  for i in range(1, H+1):
    new_li = []
    for n in range(N):
      a, b = ab_li[n]
      if a <= i:
        new_li.append(dp[i-a]+b)
      else:
        new_li.append(b)
    dp[i] = min(new_li)
  print(dp[-1])
  
if __name__ == '__main__':
  run()
# Judge status: Wrong Answer
n=int(input())
s=list(map(int,input().split()))
s=sorted(s)
 
#Alice,Bob
a=[]
b=[]
 
for i in range(n):
    if i%2==0:
        a.append(s[i])
    else:
        b.append(s[i])
        
print(sum(a)-sum(b))
# Judge status: Accepted
X = int(input())
C = 0
for i in range(-1000,1000):
	if C == 1:
		break
	for j in range(-1000,1000):
		if i**5-j**5 == X:
			print(i,j)
			C += 1
			break
# Judge status: Accepted
c,a,b = map(int,input().split())
print(a*c//2)
# Judge status: Accepted
l = [list(map(int, input().split())) for i in range(3)]

t = True
for i in range(3):
  if not l[i][0] - l[i-1][0] == l[i][1] - l[i-1][1] == l[i][2] - l[i-1][2] or not l[0][i] - l[0][i-1] == l[1][i] - l[1][i-1] == l[2][i] - l[2][i-1]:
    t = False

if t == True:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,m = map(int, input().split())
ans = (n*(n-1))//2 + (m*(m-1))//2
print(ans)
# Judge status: Accepted
X=list(map(int,input().split()))

for i in range(5):
    if X[i]==0:
        ans = i+1

print(ans)
# Judge status: Accepted
a,b = map(int,input().split())
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(a, b))
# Judge status: Accepted
def main():
    A,B = map(int,input().split())
    if ((A+B)/2)%1 != 0:
        print("IMPOSSIBLE")
    else:
        print(int((A+B)/2))


if __name__=="__main__":
    main()
# Judge status: Accepted
n = int(input())
s = input()
r = []
g = []
b = [0]*40000
for i,j in enumerate(s):
  if j == 'R':
    r.append(i)
  if j == 'G':
    g.append(i)
  if j == 'B':
    b[i] += 1
cnt = len(r)*len(g)*sum(b)
for i in r:
  for j in g:
    if b[2*j-i] == 1 :
      cnt -= 1
    if b[2*i-j] == 1 :
      cnt -= 1
    if (i+j)%2 == 0 and b[(i+j)//2] == 1:
      cnt -= 1
print(cnt)
# Judge status: Accepted
x = int(input())

for a in range(-118, 120):
    a_5 = a*a*a*a*a
    for b in range(-119, 119):
        b_5 = b*b*b*b*b
        if a_5 - b_5 == x:
            print(a, b)
            break
    else:
        continue

    break
# Judge status: Wrong Answer
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h.sort()
diff = [h[i+1] - h[i] for i in range(N-1)]
cost = 10*9
for i in range(len(diff)-((K-1)-1)):
    cost = min(sum(diff[i:i+K-1]), cost)

print(cost)
# Judge status: Accepted
price_A, price_B, price_AB, num_A, num_B = map(int,input().split())
AandB = price_A * num_A + price_B * num_B
if num_A >= num_B:
    minAB = price_AB*num_B*2 + price_A*(num_A-num_B)
else:
    minAB = price_AB*num_A*2 + price_B*(num_B-num_A)
maxAB = price_AB * max(num_A, num_B) * 2
print(min(AandB, minAB, maxAB))
# Judge status: Accepted
a,b,x = list(map(int,input().split()))
a1 = a//x if a%x else a//x-1
a2 = b//x
print(a2-a1)
# Judge status: Accepted
import collections
def calc_double(n):
    return n%2
a=input()
b=collections.Counter(a)
values=zip(*b.most_common())
c=list(values)
e=c[1]
d=list(map(int,e))
if sum(map(calc_double,d))==0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s=input()
sl=len(s)

l=[0 for i in range(sl+1)]
for i in range(sl):
    if s[i]=='<':
        l[i+1]=max(l[i]+1, l[i+1])

for i in reversed(range(sl)): # reversed(range(sl))
    if s[i]=='>':
        l[i]=max(l[i+1]+1, l[i])

print(sum(l))
# Judge status: Wrong Answer
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

w = input()
import collections
c = collections.Counter(w)
print(c)
for k, v in c.items():
    if v % 2 != 0:
        print('No')
        quit()
print('Yes')
# Judge status: Accepted
n,d=map(int,input().split())
ans=0
for i in range(n):
    x,y=map(int,input().split())
    if x**2+y**2<=d**2:
        ans+=1
print(ans)
# Judge status: Accepted
k,n=list(map(int,input().split()))
a=list(map(int,input().split()))

a.sort()

max_l=0
for i in range(n-1):
  if(a[i+1]-a[i] > max_l):
    max_l=a[i+1]-a[i]
if(a[0]+(k-a[n-1]) > max_l):
  max_l=a[0]+(k-a[n-1])

print(k-max_l)
# Judge status: Accepted
n = int(input())

cnt = 0
pbm = 0
for i in range(1, 10**6):
    cnt += i
    if cnt >= n:
        pbm = i
        break

ans = []

for i in range(pbm, 0, -1):
    if i <= n:
        ans.append(i)
        n -= i

for i in ans:
    print(i)
# Judge status: Wrong Answer
a,b=map(int,input().split())
print(b if a>=10 else b+100*(10-b))
# Judge status: Accepted
S, W = [int(_) for _ in input().split()]

if W >= S:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
N = int(input())
W = [int(w) for w in input().split()]
S1 = 0
S2 = 0
ans = []
for i in range(N):
  S2 = sum(W) - S1
  ans.append(abs(S2 - S1))
  S1 = 0
  S2 = 0
  for j in range(i + 1):
    S1 += W[j]
print(min(ans))
# Judge status: Accepted
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    mod = 10**9 + 7
    b = 1
    c = 0
    for k in range(60):
        s = sum(ai & b for ai in a) // b
        c = (c + s * (n - s) * b) % mod
        b *= 2
    print(c)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
ans=sum(a[::2])-sum(a[1::2])
print(ans)
# Judge status: Accepted
from collections import defaultdict
def main():
    N = int(input())
    vote = defaultdict(int)
    for i in range(N):
        vote[input()] += 1
    max_vote = max(vote.values())
    new_vote = sorted(list(vote.items()), key= lambda x : x[0])
    new_vote = sorted(new_vote, key= lambda x : x[1], reverse = True)
    for k, v in new_vote:
        if v == max_vote:
            print(k)
        else:
            break
if __name__ == "__main__":
    main()
# Judge status: Accepted
M=2019;t=1;p=0;c=[0]*M;r=0
for x in(input()+'0')[::-1]:p=(int(x)*t%M+p)%M;r+=c[p];c[p]+=1;t=t*10%M
print(r)
# Judge status: Accepted
s = input()
ans = ""
for i in s:
    if i == "0":
        ans += "0"
    elif i == "1":
        ans += "1"
    else:
        if ans:
            ans = ans[:-1]
print(ans)
# Judge status: Wrong Answer
L = int(input())
ans = 0
for i in range(L):
    for j in range(L):
        if i + j <= L:
            ans = max(ans, i * j * (L - i - j))
print(ans)
# Judge status: Accepted
n,m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
l_max = 0
r_min = 100000000
for i in range(m):
    if (l_max < a[i][0]):
        l_max = a[i][0]
for i in range(m):
    if (r_min > a[i][1]):
        r_min = a[i][1]
print(max(r_min-l_max+1, 0))
# Judge status: Accepted
*a,=map(int,open(0).read().split());print('bwuisnt'[sum(a)<22::2])
# Judge status: Accepted
#!/usr/bin/env python3
s = int(input())
print(10**9, 1*(s<10**18), 10**9 - s%10**9, s // 10**9 + 1*(s<10**18),0,0)
# Judge status: Wrong Answer
import math

N = int(input())
a = math.ceil(N/1.08)
b = math.floor((N+1)/1.08)
tmp = list(range(a,b+1))
print(tmp[0] if tmp else ':(')
# Judge status: Wrong Answer
N,A,B=map(int,input().split())
ans=0
for x in range(1,N+1):
  temp=0
  for y in str(x):
    temp+=int(y)
    if temp>=A and temp<=B:
      ans+=temp
print(ans)
# Judge status: Wrong Answer
A = int(input())
B = int(input())
if A != B != 1:
    print(1)
elif A != B != 2:
    print(2)
else:
    print(3)
# Judge status: Wrong Answer
N, K = map(int, input().split())
p = list(map(int, input().split()))

p.sort
total=0

for i in range(K):
    total += p[i]
    
print(total)
# Judge status: Accepted
v = input().split(" ")
x = int(v[0])
k = int(v[1])
d = int(v[2])

if (x == 0):
    if (k % 2 == 0):
        ans = 0
    else:
        ans = d
else:
    if ((k * d) > abs(x)):
        y = abs(x) // d
        ans = abs(abs(x) - y * d)
        if ((k - y) % 2 == 1):
            ans = abs(d - ans)
    else:
        ans = abs(x) - k * d
print(ans)
# Judge status: Wrong Answer
import math
import numpy as np
n = int(input())
*a, = map(int, input().split())

ave = math.ceil(sum(a)/n)
m = int(np.median(a))

ans = [0, 0]
for _a in a:
    ans[0] += (ave-_a)**2
    ans[1] += (m-_a)**2

print(min(ans))
# Judge status: Accepted
n, m = map(int, input().split())
l = []
for i in range(n):
    a = list(map(int, input().split()))
    l.append(a)
l.sort()
ans = 0

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

print(ans)
# Judge status: Accepted


import numpy as np

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

def check(x):
    s=str(x)
    for i in range(len(s)):
        if(s[i]!=s[len(s)-1-i]):return False
    return True

for i in range(a,b+1):
    if(check(i)):ans+=1
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

add1 = []
sub1 = []
for i in range(n):
    add1.append(a[i] + i)
    sub1.append(i - a[i])

dict1 = {}
dict2 = {}
for i in add1:
    if i in dict1:
        dict1[i] += 1
    else:
        dict1[i] = 1
for i in sub1:
    if i in dict2:
        dict2[i] += 1
    else:
        dict2[i] = 1

ans = 0
for k,v in dict1.items():
    if k in dict2:
        ans += v * dict2[k]

print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
  print("Possible")
else:
  print("Impossible")
# Judge status: Accepted
n, a, b = map(int, input().split())

print(n // (a + b) * a + min(a, n % (a + b)))
# Judge status: Accepted

#C
N,M,X = map(int,input().split())
C = []
A = []

for c in range(N):
	p = list(map(int,input().split()))
	C.append(p[0])
	A.append(p[1:])

minCost = sum(C)
exist = False

for i in range(2 ** N):
	rikai = [0] * M
	cost = 0
	for n in range(N):
		if i >> n & 1 == 0:
			cost+=C[n]
		
			for m in range(M):
				rikai[m]+=A[n][m]
	ok = True

	for m in range(M):
		if rikai[m] < X:
			ok = False

	if ok:
		exist = True
		minCost = min(minCost,cost)

if exist:
	print(minCost)
else:
	print(-1)
# Judge status: Accepted
a,b,c,d = map(int, input().split())
print(max(a*c, a*d, b*c, b*d))
# Judge status: Accepted
n, k = map(int, input().split())

ans = ''
while n > 0:
    ans = str(n % k) + ans
    n //= k
print(len(ans))
# Judge status: Wrong Answer
N = int(input())

result=[0,0,0,0]

for i in range(N):
  S=input()
  if S == "AC":
    result[0] += 1
  elif S == "WA":
    result[1] += 1
  elif S == "TLE":
    result[2] += 1
  else:
    result[3] += 1

print("AC × " + str(result[0]))
print("WA × " + str(result[1]))
print("TLE × " + str(result[2]))
print("RE × " + str(result[3]))
# Judge status: Accepted
X,Y,A,B,C=list(map(int,input().split()))
A_l=list(map(int,input().split()))
B_l=list(map(int,input().split()))
C_l=list(map(int,input().split()))
A_l.sort(reverse=True)
B_l.sort(reverse=True)
C_l.sort()
A_after_l=A_l[:X]
B_after_l=B_l[:Y]
ans=[A_after_l,B_after_l]
ans=sum(ans,[])
ans.sort()
import heapq
heapq.heapify(ans)
for i in C_l:
   N=heapq.heappop(ans)
   if N < i:
      heapq.heappush(ans,i)
   else:
      heapq.heappush(ans,N)
print(sum(ans))
# Judge status: Wrong Answer
N = int(input())
SP = [input().split() for _ in range(N)]
for k in range(N):
  City = "zzzzzzzzzzzzzz"
  Point = 0
  Num = 0
  for i in range(len(SP)):
    if SP[i][0] < City:
      City = SP[i][0]
  for j in range(len(SP)):
    if SP[j][0] == City and int(SP[j][1]) > Point:
      Point = int(SP[j][1])
      Num = j
  print(Num+1)
  SP[Num][0] = "zzzzzzzzzzzzzzzzz"
  SP[Num][1] = 0
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print(max([a*10+b+c,a+b*10+c]))
# Judge status: Wrong Answer
S = input()
l, r = int(S[:2]), int(S[2:])
if 0<l<13 and 0<r<13:
    print("AMBIGUOUS")
elif 0<l<13:
    print("MMYY")
elif 0<r<13:
    print("YYMM")
else:
    print("NA")
# Judge status: Accepted
n=int(input())
ans=0

for i in range(1,n+1):
  k=n//i
  ans=ans+i*k*(k+1)//2

print(ans)
# Judge status: Wrong Answer
n = int(input())

if n > 1:
    print( int(n/2) / n )
else:
    print(1)
# Judge status: Wrong Answer
N = int(input())
s = input()
t = input()

ans = N*2
for n in range(N):
    if s[n:] == t[:N-n]:
        ans -= len(s[n:])
        
print(ans)
# Judge status: Accepted
n = int(input())
for i in range(1,n+1):
    if(i**2 > n):
        print((i-1)**2)
        quit()
print(1)
# Judge status: Accepted
# solution
import math
import io
import string

data = int(input())
array = [input().rstrip() for _ in range(data)]
sets = {c: [] for c in string.ascii_lowercase}
for i in range(data):
    for c in string.ascii_lowercase:
        k = array[i].count(c)
        sets[c].append(k)
strs = ''
for c in string.ascii_lowercase:
    strs += c * min(sets[c])
print(strs)
# Judge status: Wrong Answer
a, b = map(int, input().split())
ab = a*10+b
ans = 'No'
for i in range(1, 101):
  if i*i == ab:
    ans='Yes'
    break
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())

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

H.sort(reverse=True)
print(sum(H[K:]))
# Judge status: Accepted
import sys


def input():
    return sys.stdin.readline().strip()

def main():

    # i have too make index as weight and value as value
    import numpy as np
    N, W = map(int, input().split())

    dp = np.zeros(W + 1, int)

    for i in range(N):
        w, v = map(int, input().split())
        np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
        # print(dp[:-w],dp[w:] )


    print(dp[-1])


if __name__ == "__main__":
    main()
# Judge status: Accepted
n=int(input())
a=[]
for i in range(n):
  a.append(input())

frag='Yes'
for i in range(n):
  if a.count(a[i])!=1:
    frag='No'
    break
for i in range(n-1):
  if a[i][-1]!=a[i+1][0]:
    frag='No'
    break
    
print(frag)
# Judge status: Accepted
n, x = map(int, input().split())
a = sorted(map(int, input().split()))
ans = 0
for i in range(n):
    x -= a[i]
    if x < 0:
        break
    if i == n-1:
        if x > 0:
            break
    ans += 1

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

even = k // 2
odd = k - even
print(even * odd)
# Judge status: Wrong Answer
n, a, b, c, d = map(int, input().split())
s = input()

ans = 'Yes'
if s.find('##') > -1:
    ans = 'No'
else:
    if d < c:
        if s[b-1:d].find('...') == -1:
            ans = 'No'

print(ans)
# Judge status: Accepted
N = int(input())
A = [0] + [int(input()) for _ in range(N)]

ans = 0
for i in range(1,N+1):
    if A[i] != 0:
        ans += A[i-1]
        A[i] -= A[i-1]
    ans += A[i]//2
    A[i] = A[i]%2

print(ans)
# Judge status: Accepted
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
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")
# Judge status: Accepted
# Problem B - KEYENCE String

# input
s = input()
s_l = len(s)

# initialization
is_ok = False

# check
for i in range(s_l):
    for j in range(i, s_l):
        tmp_s = s[:i] + s[j:]
        if tmp_s=='keyence':
            is_ok = True
            break

# output
if is_ok:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
N=int(input())
A=input()
flag = []

for i in range(N-1):
  if A[i]<=A[i+1]:
    flag.append(1)
  elif i>0 and A[i]==A[i+1]:
    flag.append(flag[i-1])
  else:
    flag.append(-1)

ans = 1
c = 1
for i in range(N-2):
  if flag[i]!=flag[i+1] and c!=0:
    ans+=1
    c=0
  else:
    c+=1

print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
c = input()
c = ord(c) + 1
print(chr(c))
# Judge status: Wrong Answer
S_list = list(map(int,input().split()))
A,B,C,D = S_list
takahashi ,aoki = A, C
while takahashi > 0 or aoki > 0:
    aoki = aoki - B
    if aoki <=0:
        break
    takahashi = takahashi - D
    
if takahashi > aoki:
    result = "Yes"
else:
    result = "No"
print(result)
# Judge status: Wrong Answer
x = int(input())

if 7 <= x <= 11:
    print(2)
elif x <= 6:
    print(1)
else:
    a, b = divmod(x, 11)
    if b == 0:
        print(2*a)
    else:
        print(2*a+1)
# Judge status: Accepted
line = input().split()
l = [int(s) for s in line]



if -100 <= l[0] <= l[2] <= l[1]<=100:
    
    print("Yes")
    
else:
    print("No")
# Judge status: Wrong Answer
input()
s1 = input().split(" ")
s2 = input().split(" ")
ss1 = [int(i) for i in s1]
ss2 = [int(i) for i in s2]
import itertools
a=0
b=0
c = 0
for i in itertools.permutations([int(i) for i in range(1,9)]):
  c+=1
  if list(i) == ss1:
    a=c
  if list(i) == ss2:
    b=c
print(abs(a-b))
# Judge status: Accepted
C=input()
uni_num = ord(C)
print(chr(uni_num+1))
# Judge status: Accepted
A = [int(x) for x in input().split()]

A.sort()
reg = 0
diff_1 = (A[2] - A[0]) // 2
reg += diff_1
diff_2 = (A[2] - A[1]) // 2
reg += diff_2
A[0] += 2 * diff_1
A[1] += 2 * diff_2

A.sort()
if A[0]==A[1]==A[2]:
    print(reg)
elif A[0]==A[1]:
    print(reg+1)
else:
    print(reg+2)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

cnt2 = sum(i % 4 == 2 for i in a)
cnt4 = sum(i % 4 == 0 for i in a)
print('Yes 'if n <= 2 * cnt4 + max(1, cnt2) else 'No')
# Judge status: Accepted
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)
N=int(input())
ans=1
for i in range(N):
    t=int(input())
    ans=lcm(ans,t)
print(ans)
# Judge status: Accepted
c1 = input()
c2 = input()
if c1 == c2[::-1]:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
l,r,d = map(int,input().split())
ans = 0
for i in range(l,r+1):
    if i%d == 0:
        ans += 1
print(ans)
# Judge status: Accepted
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
n=int(input())
if n<105:
    print(0)
    exit()
ans=1
for i in range(106,n+1):
    if i%2==0:
        continue
    l=make_divisors(i)
    if len(l)==8:
        ans+=1
print(ans)
# Judge status: Accepted


def main():
    alpha = input()
    if alpha.isupper():
        print('A')
    else:
        print('a')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S = input().strip()
C = {"N":0,"S":0,"E":0,"W":0}
for i in range(len(S)):
    C[S[i]] += 1
if C["N"]==C["S"] and C["E"]==C["W"]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, K = map(int, input().split())
H_list = list(map(int, input().split()))

H_list = list(reversed(sorted(H_list)))

H_list = H_list[K:]

print(sum(H_list))
# Judge status: Accepted
x,y=map(int,input().split())
ans = 0
while x<=y:
  ans += 1
  x *=2
print(ans)
# Judge status: Wrong Answer
n,k = map(int,input().split())
d = list(map(str, input().split()))
 
while True:
    print([i in d for i in list(str(n))])
    if sum([i in d for i in list(str(n))]) == 0:
        print(n)
        break
    n+= 1
# Judge status: Accepted
# -*- coding: utf-8 -*-
N = int(input())
A = [int(i) for i in input().split()]

ans = []
for i in range(N):
    count = 0
    while True:
        if A[i] % 2 != 0:
            ans.append(count)
            break
        else:
            A[i] /= 2
            count += 1
print(min(ans))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
cnt2 = 0
cnt4 = 0
for i in range(n):
    if(a[i] % 4 == 0):
        cnt4 += 1
    elif(a[i] % 2 == 0):
        cnt2 += 1

if((cnt4 * 2 + 1) >= n or cnt2 >= (n - (cnt4 * 2 + 1) + (cnt4 > 0))):
    print("Yes")
else:
    print("No")