peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a = [int(input()) for _ in range(5)]
k = int(input())
for i in range(4):
  if a[i+1] - a[0] > k:
    print(":(")
    exit()
print("Yay!")
# Judge status: Accepted
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
A1 = []
A2 = []

for i in range(1,N+1):
   A1.append(i + A[i-1])
   A2.append(i - A[i-1])
  
c1 = Counter(A1)
c2 = Counter(A2)

result = 0
for k in set(c1).intersection(c2):
    result += c1[k] * c2[k]
print(result)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(N):
    if i%2==0 and A[i]%2!=0:
        ans+=1
print(ans)
# Judge status: Wrong Answer
N,H=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]
B=[]
C=[]
for a,b in A:
  B.append(a)
  C.append(b)
D=sorted(B)[::-1]
b=D[0]
F=[]
for i in C:
  if b<i:
    F.append(i)
cnt=0
for i in F:
  H-=i
  cnt+=1
  if H<=0:
    print(cnt)
    exit()
print(cnt-((-H)//b))
# Judge status: Accepted
x,y=map(int,input().split())
print(-1 if x%y==0 else x)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
A = A
f = 0
ans = 1
for k in range(N-1):
    if f == 0:
        if A[k] > A[k+1]:
            f = -1
        elif A[k] < A[k+1]:
            f = 1
    elif f == 1:
        if A[k] > A[k+1]:
            ans += 1
            f = 0
    else:
        if A[k] < A[k+1]:
            ans += 1
            f = 0
print(ans)
# Judge status: Accepted
s = input()
if "a" in s and "b" in s and "c" in s:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
mod = 998244353
count = [0]*(10**5+1)
L = list(map(int,input().split()))
M = max(L)
ans = 0
for i in range(n):
  count[L[i]] += 1
for i in range(M+1):
  if count[i] == 0:
    ans = 0
    break
  else:
    if i == 0:
      if count[i] != 1:
        ans = 0
        break
      else:
        ans = 1
    else:
      ans = ans*((count[i-1]**count[i])%mod)
      ans = ans%mod
if L[0] == 0:
  print(ans)
else:
  print(0)
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      a = l[i]
      b = l[j]
      c = l[k]
      if a == b or b == c or c == a:
        continue
      if l[i] + l[j] > l[k]:
        ans += 1
print(ans)
# Judge status: Accepted
from collections import defaultdict

N, M = map(int, input().split())
iPY = []
D = defaultdict(list)
E = defaultdict(int)

for i in range(M):
  P, Y = map(int, input().split())
  iPY.append((i, P, Y))

iPY.sort(key = lambda x: x[2])

for i, P, Y in iPY:
  D[P].append(Y)

for P, Ys in D.items():
  for i, Y in enumerate(Ys):
    E[Y] = "000000"+str(i+1)

iPY.sort()

for i, P, Y in iPY:
  U = "000000"+str(P)
  L = E[Y]
  print(U[-6:]+L[-6:])
# Judge status: Wrong Answer
n, m, k = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
max = 10 ** 9 + 1
time = 0
ans = 0
a = 0
b = 0

for i in range(n + m):
    if a_list[a] < b_list[b]:
        time += a_list[a]
        a += 1
    else:
        time += b_list[b]
        b += 1

    if time > k:
        break
    else:
        ans += 1

    if a >= n:
        a_list.append(max)
    if b >= m:
        b_list.append(max)

print(ans)
# Judge status: Wrong Answer
import numpy as np
N = int(input())
As = np.array(list(map(int, input().split())))
m = 10**9 + 7
result = 0
a = (As.sum() ** 2)
b = (As ** 2).sum()
print(int(((a - b)/2)%m))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
c=Counter(a)
a=set(a)
ans=0
for aa in a:
  t=0
  t+=c[aa-1]
  t+=c[aa]
  t+=c[aa+1]
  ans=max(ans,t)
print(ans)
# Judge status: Accepted
l = [int(input()) for _ in range(5)]
k = int(input())
for i in range(5):
    for j in range(i+1,5):
        if l[j]-l[i] > k:
            print(":(")
            exit(0)
print("Yay!")
# Judge status: Accepted
n = int(input())
a_li = list(map(int,input().split()))
low = a_li[0]
high = a_li[0]
old = a_li[0]
yen = 1000
for i in range(1,n):
    if old < a_li[i]:
        div, yen = divmod(yen, old)
        yen += div * a_li[i]
    old = a_li[i]
print(yen)
# Judge status: Accepted
n=int(input())
s=input()
if s[0:n//2]==s[n//2:n]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split())) 
tmp=[]
ans=True
for i in A:
  if i%2==0:
    tmp.append(i)
  else:
    continue

for i in tmp:
  if i%3==0 or i%5==0:
    continue
  else:
    ans=False
    
if ans:
  print("APPROVED")
else:
  print("DENIED")
# Judge status: Accepted
n=int(input())
dif=list(map(int,input().split()))
dif.sort()
print(dif[int(n/2)]-dif[int(n/2-1)])
# Judge status: Accepted
n,x = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
count = 0
s = 0
for i in range(n):
    if i == n-1:
        if x == a[i]:
            count += 1
    else:
        s += a[i]
        if x > a[i]:
            x -= a[i]
            count += 1
        elif x < a[i]:
            break
        else:
            count += 1
            break
print(count)
# Judge status: Accepted
n = int(input())
s = input()
t = input()

a = 0
for i in range(n):
    if s[n - i - 1:] == t[:i + 1]:
        a = i + 1
print(n * 2 - a)
# Judge status: Accepted
(s, w) = tuple(map(int, input().split(" ")))
if w >= s:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
N,K = map(int,input().split())
P = list(map(int,input().split()))

cums = [0]
for p in P:
    cums.append(cums[-1] + (p+1)/2)
ans = 0
for i in range(N-K+1):
    ans = max(ans, cums[i+K] - cums[i])
print(ans)
# Judge status: Wrong Answer
N, M = map(int, input().split())
if N == 1 and M == 1:
    print(1)
elif N == 1:
    print(M - 2)
else:
    print((N - 2) * (M - 2))
# Judge status: Accepted
n, k = map(int, input().split())

ans = 0
for i in range(n):
  for j in range(21):
    if  (i+1)*(2**j) >= k:
      break
  ans += 1/(n * 2**j)
  
  if j == 0:
    break
    
ans += (n-i-1)/n
print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    X, A, B = map(int, input().split())
    if X - A < 0:
        print('dangerous')
    elif A - B < 0:
        print('safe')
    else:
        print('delicious')


if __name__ == "__main__":
    main()
# Judge status: Accepted
import math

k, = list(map(int,input().split()))
print(abs(360*k) // math.gcd(360, k) // k)
# Judge status: Accepted
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = list(input())
n = len(s)
t = list(input())
for i in range(n+5):
    now = []
    now.append(s[-1]); s.pop(-1) 
    now += s
    s = now
    if s == t:
        print('Yes')
        break
else:
    print('No')
# Judge status: Accepted
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
b = np.array(list(range(1, n+1)))
if sum(a != b) <= 2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N=int(input())
T, A=map(int, input().split())
H=input().split()
V=[abs(T-0.006*int(h)-A) for h in H]

minv = V[0]
index=0

for i,v in list(enumerate(V)):
    if v<minv:
        minv=v
        index=i

print(index+1)
# Judge status: Accepted
from collections import Counter
S = input()
S = S[::-1]
N = len(S)
counter = Counter()
counter[0] = 1
prev = 0
MOD = 2019
for i in range(N):
  c = (int(S[i]) * pow(10, i, MOD) )%MOD
  prev = (prev+c)%MOD
  counter[prev] += 1

ans = 0
for k,v in counter.items():
  ans += (v * (v-1))//2


print(ans)
# Judge status: Wrong Answer
n,A,B=map(int,input().split())
s=input()
cnt_b=0
cnt_c=0
for i in range(n):
	if s[i]=='a':
		if i+1<=A+B+cnt_c:
			print('Yes')
		else:
			print('No')
	elif s[i]=='b':
		cnt_b+=1
		if i+1<A+B+cnt_c and cnt_b<=B:
			print('Yes')
		else:
			print('No')
	elif s[i]=='c':
		print('No')
		cnt_c+=1
# Judge status: Accepted
x = int(input())

ans = x // 11 * 2
print(ans + (x % 11 > 0) + (x % 11 > 6))
# Judge status: Accepted
#!/usr/bin/env python3

import math

n = int(input())

result = [0] * (n + 1)
border = 0
if n>=3:
    border = int(math.sqrt(n - 2))
for x in range(1, border):
    for y in range(1, border):
        for z in range(1, border):
            r = ((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2) // 2
            if r > n:
                break
            else:
                result[r] += 1

for num in result[1::]:
    print(num)
# Judge status: Accepted
n, m = map(int, input().split())
h = list(map(int, input().split()))
li = list(range(1,n+1))
ab = [list() for _ in range(m)]

p = []

ih = dict(zip(li, h))

for i in range(m):
    a, b = map(int,input().split())
    c = ih[a]
    d = ih[b]
    if c>d:
        p.append(b)
    elif d>c:
        p.append(a)
    else:
        p.append(a)
        p.append(b)

print(n-len(set(p)))
# Judge status: Accepted
N = int(input())

from math import floor

ans = 0
for x in range(1,50001):
    if N == floor(x*1.08):
        ans = x

if ans == 0:
    print(':(')
else:
    print(ans)
# Judge status: Wrong Answer
l = [int(x) for x in input().split()]

l.sort(reverse=True)


if len([x for x in l if x % 2 != 0]) == 0:
    print(0)
else:
    ans = min(l[1]*l[2], l[0]*l[1], l[0]*l[2])
    print(ans)
# Judge status: Wrong Answer
S = input()
a = [0]*(len(S)+1)

for i in range(len(S)):
    if S[i] is '<':
        a[i+1] = max(a[i+1], a[i]+1)

for i in range(1, len(S)):
    if S[-i] is '>':
        a[-(i+1)] = max(a[-(i+1)], a[-i]+1)
print(sum(a))
# Judge status: Accepted
s = input()
l = r = 0
for i in range(len(s)):
    if s[i] == "A":
        l = i
        break
for i in range(len(s)-1, 0, -1):
    if s[i] == "Z":
        r = i
        break
print(r-l+1)
# Judge status: Wrong Answer
N = int(input())
H = list(map(lambda h: int(h), input().split(" ")))

lower = [0]
movable = 0
for i in range(len(H) - 1):
  if H[i] >= H[i + 1]:
    movable += 1
  else:
    lower.append(movable)
    movable = 0

print(max(lower))
# Judge status: Accepted
n,k = map(int,input().split())
s = input()
ss = s.lower()
ans = ""
for i in range(n):
  ans += ss[i] if i == k-1 else s[i]


print(ans)
# Judge status: Accepted
def solve():
    N, M = map(int, input().split())
    
    num = []
    red = []
    for i in range(N+1):
        num.append(1)
        red.append(0)
    red[1] = 1
    
    for _ in range(M):
        x, y = map(int, input().split())
        if red[x] == 1:
            red[y] = 1
        num[x] -= 1
        num[y] += 1
        if num[x] == 0:
            red[x] = 0
    
    return sum(red)

print(solve())
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))
Can = [0]*n
ans = 0
can = 1
for i,a in enumerate(A):
    if can < a:
        print(-1)
        exit(0)
    elif i < n:
        can -= a
        can *= 2
        Can[i] = can
real = A[-1]
for i in range(n-1,-1,-1):
    ans += real
    real = min(real,Can[i]//2)
    real += A[i]
print(ans + 1)
# Judge status: Accepted
n,m = map(int, input().split())
if n<=m:
  print(n)
else:
  print(n-1)
# Judge status: Wrong Answer
n = int(input())

if n == 1:
    print("0")
else:
    ans = (n-1)*n/2
    print(int(ans))
# Judge status: Accepted
n = int(input())
t_list = [int(input()) for nesya in range(5)]
z = min(t_list)
for t in t_list:
  if z == t:
    if n%t == 0:
      t_ = n//t
    else:
      t_ = n//t+1
    print(t_ + 4)
    break
# Judge status: Wrong Answer
A,B,D=map(int,input().split())
count=0
D+=0.5
while True:
    if D-A>=1:
        count+=1
        D-=A
    else:
        print(count*B)
        exit()
# Judge status: Accepted
n,m = map(int,input().split())
left = 0
right = n
for i in range(m):
  l,r = map(int,input().split())
  left = max(left,l)
  right = min(right,r)
print(max(0,right-left+1))
# Judge status: Accepted
n = int(input())
k = list(map(int,input().split()))
l = [0 for i in range(n)]
for i in range(n):
    l[k[i]-1] = i + 1

for i in range(n):
    print(l[i],end=" ")
# Judge status: Wrong Answer
s = input()
ss = sorted(set(s))
cnt = ord('a')
for c in ss:
    if ord(c) == cnt:
        cnt += 1
    else:
        print(chr(cnt))
        exit()
if cnt == ord('z'):
    print('None')
else:
    print(chr(cnt))
# Judge status: Accepted
s = input ()
c = 0
for i in range (3):
    if s[i] == '1':
        c += 1
print (c)
# Judge status: Wrong Answer
arr1 = list(map(int,input().strip().split()))
arr2 = list(map(int,input().strip().split()))
time = int(input())

oni = arr1[0]+arr1[1]*time
nige = arr2[0]+arr2[1]*time
print(oni)
print(nige)
if oni >= nige:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a,b = map(int,input().split())
l = list(input())
for i in range(a+b+1):
    if i == a:
        if l[i] != "-":
            print("No")
            exit()
    else:
        if l[i] == "-":
            print("No")
            exit()
print("Yes")
# Judge status: Accepted
k = int(input())

m = 0

for i in range(1, 10**7):
    n = m *10 +7
    m = n % k
    if m == 0:
        print(i)
        exit(0)

print(-1)
# Judge status: Accepted
n = int(input())
cnt = 0

def factorization(n):
	arr = []
	temp = n
	for i in range(2, int(-(-n**0.5//1))+1):
		if temp%i==0:
			cnt=0
			while temp%i==0:
				cnt+=1
				temp //= i
			arr.append([i, cnt])
	if temp!=1:
		arr.append([temp, 1])
	if arr==[]:
		arr.append([n, 1])
	return arr

a = factorization(n)
c = 0
for i in a:
	k = 1
	x = i[1]
	while x >= 0:
		x -= k
		if x < 0:
			break
		c += 1
		k += 1
if n == 1:
	print (0)
else:
	print (c)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a == b == c:
    if a % 2 == 0:
        print(-1)
        exit(0)
    else:
        print(0)
        exit(0)
ans = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    al = b // 2 + c // 2
    bl = a // 2 + c // 2
    cl = a // 2 + b // 2
    a = al
    b = bl
    c = cl
    ans += 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
S = input()


def calculate(n, s):
    arr = list(s)
    result = []

    leftW = 0
    rightR = arr.count('R')



    for i in range(n):
        val = arr[i]

        if val == 'R':
            rightR -= 1

        if val == 'W':
            leftW += 1

        result.append(max(leftW,rightR))

    if len(result) == 0:
        print(-1)
    else:
        print(min(result))

calculate(N, S)
# Judge status: Accepted
N,X,Y = map(int,input().split())
d=[0]*(N-1)
 
for i in range(N-1):
	for j in range(i+1,N):
		d[min(j-i-1,abs(X-1-i)+abs(Y-1-j))]+=1
		
for i in range(N-1):
	print(d[i])
# Judge status: Wrong Answer
s=input()
l=len(s)
ans=float('inf')
for i in range(l-2):
  x=int(s[i:i+3])
  ans=min(ans, x)
print(ans)
# Judge status: Wrong Answer
import math

def countDividers(n):
    divisors = []
    for i in range(1, int(math.sqrt(n))):
        if n % i == 0:
            divisors.append(i)
            divisors.append(int(n/i))
    return len(divisors)


if __name__ == '__main__':
    n = int(input())
    count = 0
    for i in range(1,n+1):
        if i %2 ==1 and countDividers(i) == 8:
            count += 1
           
    print(count)
# Judge status: Wrong Answer
a = input()
if a[0] == 9 or a[1] == 9:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
n = int(input())
tmp = 0
li = []
for i in range(n):
    if i*(i+1)/2 >= n:
        tmp = i
        break
new_li = [x for x in range(1,tmp+1)]
#print(new_li)
if sum(new_li) - n > 0:
    new_li.remove(sum(new_li) - n)
if n == 1:
    print(1)
else:
    for n in new_li:
        print(n)
# Judge status: Accepted
import numpy as np
n, k, q = map(int, input().split())

A = [k for _ in range(n)]

for i in range(q):
    t = int(input())
    A[t-1] +=1

for i in range(n):
    if A[i]-q > 0:
        print('Yes')
    else :
        print('No')
# Judge status: Wrong Answer
x,k,d = map(int,input().split())
jud = x//d +1
if(k<=jud):
  print(abs(abs(x)-d*k))
else:
  if((k-jud)%2 == 1):
    print(abs(abs(x)-(jud-1)*d))
  else:
    print(abs(abs(x)-(jud)*d))
# Judge status: Accepted
A,B = map(int,input().split())


print(A*B)
# Judge status: Accepted
import math
from collections import Counter

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

def cmb(r,k):
  if r < k: return 0
  return math.factorial(r) // math.factorial(r-k) // math.factorial(k)

c = Counter()
for a in A:
  c[a] += 1
al = 0
for v in c.values():
  al += cmb(v,2)

for k in range(N):
  print(al - (c[A[k]]-1))
# Judge status: Accepted
from itertools import accumulate
n,k = map(int, input().split())
As = list(map(int, input().split()))
for i in range(k):
    imos = [0] * (n+1)
    for i,a in enumerate(As):
        l = max(0, i-a)
        r = min(n, i+a+1)
        imos[l] += 1
        imos[r] -= 1
    acc = list(accumulate(imos))
    # 指数関数的に増える
    if acc[:-1] == As:
        print(*As)
        exit()
    As = acc[:-1]
print(*As)
# Judge status: Accepted
[H,W] = list(map(int,input().split(' ')))
K = int((H*W+1)*0.5)
if H==1 or W==1:print(1)
else:print(K)
# Judge status: Accepted
H, N = map(int, input().split())
A = list(map(int, input().split()))

if sum(A) >= H:
    print('Yes')
else:
    print("No")
# Judge status: Accepted
w,h,n = map(int, input().split())

x1,x2,y1,y2 = 0,0,0,0
for _ in range(n):
  x,y,a = map(int, input().split())
  if a == 1: x1 = max(x1, x)
  if a == 2: x2 = max(x2, w-x)
  if a == 3: y1 = max(y1, y)
  if a == 4: y2 = max(y2, h-y)

w -= x1+x2
h -= y1+y2
if w > 0 and h > 0: print(w*h)
else: print(0)
# Judge status: Accepted
n = int(input())
w = [input() for _ in range(n)]
if len(set(w)) != n:
    print('No')
    exit()
for i in range(1, n):
    if w[i][0] != w[i - 1][-1]:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
n,m=map(int,input().split())
c=[[] for _ in range(n)]
for i in range(m):
    p,y=map(int,input().split())
    c[p-1].append([i,y])
ans=[0]*m
for i in range(n):
    c[i].sort(key=lambda x:x[1])
    for j in range(len(c[i])):
        ID=str(i+1).zfill(6)+str(j+1).zfill(6)
        ans[c[i][j][0]]=ID
print(*ans,sep="\n")
# Judge status: Accepted
#!/usr/bin/env python3
s = int(input())
if s <= 10**9:
    print(s, 0, 0, 0, 0, 1)
else:
    print(10**9, 1*(s<10**18), 10**9 - int(str(s)[-9:]), s // 10**9 + 1*(s<10**18),0,0)
# Judge status: Accepted
N = int(input())

S = []
for i in range(1, N+1):
    C, P = input().split()
    s = [i, C, int(P)]
    S.append(s)

S.sort(key=lambda x: (x[1], -(x[2])))

for i in S:
    print(i[0])
# Judge status: Accepted
n = int(input())
l = list(input())
m = []

for i in range(n - 1):
    ref = list(input())
    for j in ref:
        if j in l:
            m.append(j)
            l.remove(j)
    l = m
    m = []
l.sort()

print("".join(l))
# Judge status: Accepted
def main():
    K = int(input())
    a, b = map(int, input().split())
    flag = False
    for i in range(a, b+1):
        if i % K == 0:
            flag = True
    if flag:print("OK")
    else:print("NG")

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
c=0
a = int(input())
for i in range(1,100001):
    f=0
    if i>12:
        l = [int(x) for x in list(str(i))]
        for j in range(1,len(str(i))):
            if abs(l[j-1]-l[j])>1:
                f=1
    if f==0:
        c+=1
    if c==a:
        print(i)
        break
# Judge status: Accepted
n=int(input())
a=list(map(int, input("").split()))
o=0
aa=[]
for i in a:
    aa.append(i**2)
s=sum(a)
o=(s**2-sum(aa))//2
o%=10**9+7
print(o)
# Judge status: Accepted
hp, attack = map(int, input().split())
print(hp // attack ) if hp % attack == 0 else print(hp // attack + 1)
# Judge status: Accepted
H,N = map(int,input().split(" "))
A = tuple(map(int,input().split(" ")))
dam = sum(A)
if H <= dam:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import math
n,d=map(int,input().split())
count=0
for i in range(n):
  x,y=map(int,input().split())
  p=math.ceil(math.pow(x,2)+math.pow(y,2))
  r=math.ceil(math.sqrt(p))
  if(r==d):
    count+=1
print(count)
# Judge status: Wrong Answer
import math

n=int(input())
e = [[int(i) for i in input().split()] for i in range(n)] 
c=0

for i in range(n):
    for j in range(n):
        if i!=j:
            c+=math.sqrt((e[i][0]-e[j][0])**2+(e[i][1]-e[j][1])**2)
        print(c)
print(c/n)
# Judge status: Wrong Answer
a=int(input())
b=a//1000
c=b+1
d=c*1000-a
print(d)
# Judge status: Accepted
x,a,b = map(int, input().split())

print('A' if abs(x-a) < abs(x-b) else 'B')
# Judge status: Accepted
s = input()
a = 0
for i in range(len(s)):
    if s[i] != s[-i-1]:
        a += 1
print(a//2)
# Judge status: Wrong Answer
n,k=map(int,input().split());s=input();print(s[k-1].lower())
# Judge status: Accepted
n = list(map(int, input().split()))
n.sort()
print(n[0]*n[1]//2)
# Judge status: Wrong Answer
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
n = len(s)
ans = 0
for i in range(n-1):
    if s[i] != s[i-1]:
        ans += 1
print(2*ans)
# Judge status: Accepted
import sys
import math
input = lambda: sys.stdin.readline().rstrip()


def factorize(n):
    b = 2
    fct = set()
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct |= set([b])
        b = b + 1
    if n > 1:
        fct |= set([n])
    return fct


def solve():
    A, B = map(int, input().split())
    ap = factorize(A)
    bp = factorize(B)
    ans = 1 + len(ap & bp)
    print(ans)


if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
R=[0]
L=list()
N=int(input())
for i in range(N):
  k=int(input())
  L.append(k)
  if k==0:
    R.append(len(L))
S=sum(L)
R.append(N)
for i in range(len(R)-1):
  if sum(L[R[i]-1:R[i+1]])%2==1:
    S=S-1
print(S//2)
# Judge status: Accepted
from math import ceil

n = int(input())
# ans = ceil(n / 11) * 2
# print(ceil(n / 11) * 2, (n // 11) * 2)
ans = (n // 11) * 2
rem = n % 11
if rem == 0:
    ans = ans
elif rem <= 6:
    ans = ans + 1
else:
    ans = ans + 2
print(ans)
# Judge status: Wrong Answer
N, M = map(int, input().split())


data = [[0] * 2 for _ in range(M)]

for i in range(M):
    data[i][0] = i + 1
    data[i][1] = N - (i)

for i in range(M):
    print("{} {}".format(data[i][0], data[i][1]))
# Judge status: Wrong Answer
from itertools import permutations
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

ret = [i for i in range(1, n + 1)]
a = 0
b = 0
perm_list = permutations(ret)
for i, j in enumerate(perm_list):
    if p == list(j):
        a = i
    elif q == list(j):
        b = i

print(abs(a-b))
# Judge status: Wrong Answer
a=int(input())
ans=1
while True:
    if a==4:
        break
    elif a%2==0:
        a=a/2
        ans+=1
    else:
        a=3*a+1
        ans+=1
print(ans+3)
# Judge status: Wrong Answer
n, m = map(int, input().split())
l = [list(map(int, input().split(' '))) for _ in range(m)]
l = sorted(l)
#print(n,m)
#print(l)

x = l[0][0]
y = 1
#print(x)

for i in range(m):
    if l[i][0] == x:
        l[i][1] = y
        y += 1
    else:
        y = 1
        l[i][1] = y
        y += 1
        x = l[i][0]
#print(l)

for j in range(m):
    print(str(l[j][0]).rjust(6,'0') + str(l[j][1]).rjust(6,'0'))
# Judge status: Accepted
a,b,k=map(int,input().split())
syou=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        syou.append(i)
#print(syou)
print(syou[-k])
# Judge status: Accepted
N = int(input())
S = input()
x = 0
ans = 0

for i in range(len(S)):
  if S[i] == 'I':
    x += 1
    ans = max(x, ans)
  else:
    x -= 1
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
cnt = 0
while n >= k**cnt:
    cnt += 1
print(cnt)