peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import itertools, bisect

N = int(input())
L = sorted(list(map(int, input().split())))

ans = 0
for a, b in itertools.combinations(L, 2):
    ans += bisect.bisect_left(L, a + b) - bisect.bisect_right(L, b)
print(ans)
# Judge status: Accepted
import sys
input=sys.stdin.readline

a,c=map(int,input().split())
ans=a+c/2
print(int(ans))
# Judge status: Wrong Answer
from math import sqrt,floor
N,M =map(int,input().split())
ans = 1
n = N
for g in range(1,floor(sqrt(M)+1)):
    if M%g == 0:
        x = M//g
        if x > floor(sqrt(N)) and g >= N:
            ans = x
        if x >= N:
            ans = g
print(ans)
# Judge status: Accepted
if sum(map(int, input().split())) >= 22:
    ans = 'bust'
else:
    ans = 'win'
print(ans)
# Judge status: Accepted
X, N = list(map(int, input().split()))
if N == 0: print(X)
else:
    p = list(map(int, input().split()))
    if not X in p:
        print(X)
    else:
        q = [X-1, X+1]

        while True:

            if not q[0] in p:
                print(q[0])
                break
            elif not q[1] in p:
                print(q[1])
                break
            q = [q[0]-1, q[1]+1]
# Judge status: Accepted
# coding: utf-8

n = int(input().rstrip())

monster = [int(i) for i in input().rstrip().split(" ")]

def get_dev(num1:int, num2:int):
    if num1 % num2 == 0:
        return num2
    return get_dev(num2, num1 % num2)

cur = monster[0]
for i in range(1,n):
    cur = get_dev(cur, monster[i])

print(cur)
# Judge status: Wrong Answer
n,m = map(int,input().split())
ls = list(map(int,input().split()))
if sum(ls) < n:
    print(n-sum(ls))
else:
    print("-1")
# Judge status: Accepted
n = int(input())
n = n%10
if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print("hon")
elif n == 3:
    print("bon")
else:
    print("pon")
# Judge status: Accepted
s=int(input())
m=10**9+7
dp=[0]*(s+1)
dp[0]=1
for i in range(1,s+1):
  for j in range(0,(i-3)+1):
    dp[i]+=dp[j]
    dp[i]%=m
print(dp[s])
# Judge status: Wrong Answer
import sys
 
stdin = sys.stdin

mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

a, b, c = na()
if a * c <= b:
    print(a * c)
else:
    print(b // a)
# Judge status: Accepted
n=int(input())
l=[]
for i in range(1,n+1):
    if i%3==0:l.append(0)
    elif i%5==0:l.append(0)
    else:l.append(i)
print(sum(l))
# Judge status: Accepted
n,m = map(int,input().split())

if n>=2 and m>=2:
    n-=2
    m-=2
    print(n*m)
elif n==1 and m==1:
    print(1)
else:
    print(max(n,m)-2)
# Judge status: Accepted
n=int(input())
A=[]
for i in range(n):
    A.append(int(input()))

import numpy as np
print(np.lcm.reduce(A))
# Judge status: Wrong Answer
s = list(input())
n = len(s)
if (
    s[: (n - 1) // 2] == s[: (n - 1) // 2][::-1]
    and s[(n + 1) // 2 :] == s[(n + 1) // 2 :][::-1]
):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
ans=0
for i in range(1,N+1,2):
  count=0
  for j in range(1,i+1):
    if i%j==0:
      count+=1
  if count==8:
    ans+=1
print(ans)
# Judge status: Accepted
a,b=input().split()
print( b*int(a) if a>b else a*int(b))
# Judge status: Wrong Answer
k = int(input())
count = 0
temp = ''
remainder = 0
reminder_list = []

while True:
    count += 1
    temp += '7' # 7, 77, 777,,,
    reminder = int(temp) % k
    print(reminder)
    if reminder in reminder_list:
        count = -1
        break
    if reminder == 0:
        break
    else:
        temp = str(reminder % k)
    reminder_list.append(reminder)
print(count)
# Judge status: Accepted
s=input()
c=0
m=0
flg=False
for x in s:
    if x=="R" and flg:c+=1;m=max(m,c)
    if x=="R" and not flg:
        flg=True
        c=1
        m=max(m,c)
    if x=="S":
        flg=False
        c=0
print(m)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def main():
    N, x = map(int, input().split())
    a_list = list(map(int, input().split()))
    for i, a in enumerate(sorted(a_list), start=1):
        x -= a
        if x < 0:
            break
    if x >= 0:
        print(i)
    else:
        print(i-1)

if __name__ == '__main__':
    main()
# Judge status: Accepted
X = int(input())
dp = [0 for _ in range(X + 110)]
dp[0] = 1
for i in range(X + 1):
    if dp[i] == 0:
        continue
    dp[i + 100] = 1
    dp[i + 101] = 1
    dp[i + 102] = 1
    dp[i + 103] = 1
    dp[i + 104] = 1
    dp[i + 105] = 1
print(dp[X])
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

ans=0
mn=0
mi=abs(a[0])
for i in range(n):
    if a[i]<=0:
        mn += 1
    s=abs(a[i])
    ans += s
    mi=min(s,mi)
if mn%2==1:
    ans -= mi*2
print(ans)
# Judge status: Accepted
x, y = map(int, input().split())

if x%y == 0:
    ans = -1
else:
    ans = 0
    cnt = 2
    while True:
        if (x*cnt)%y != 0:
            ans = x*cnt
            break
        else:
            cnt += 1

print(ans)
# Judge status: Accepted
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = INT()
A = LI()
A = A + sorted(A, reverse = True)[1 : ]
A.sort(reverse = True)
ans = 0

for i in range(N - 1):
    ans += A[i]
    
print(ans)
# Judge status: Accepted
x=int(input())
ans=2*(x//11)

if 1<=x%11<=6:
  ans+=1
elif 7<=x%11<=10:
  ans+=2
print(ans)
# Judge status: Wrong Answer
S = int(input())
if S<2:
  print(0)
else:
  ma = int(S/3)
  if S/9<0:
    mi = 1
  elif S%9==0:
    mi =int(S/9)
  else:
    mi = int(S/9)+1
  ans=0
  from scipy.special import comb
  for i in range(mi,ma+1):
    if i==1:
      ans=1
      continue;
    x = S-i*3
    ans+=comb(x+i-1, x, exact=True, repetition=True)
    #ans+=math.factorial(x+i-1)/(math.factorial(i-1)*math.factorial(x))
  print(int(ans%(10**9+7)))
# Judge status: Wrong Answer
# coding: utf-8
import collections
N = int(input())
A=  list(map(int,input().split()))

A.sort()

c = collections.Counter(A)
A_ = list(set(A))
ans = 0
for a in A_:
    ans += min(a-c[a],c[a])

print(ans)
# Judge status: Accepted
N=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
  for j in range(i+1,N-1):
    for k in range(j+1,N):
      a,b,c = L[i],L[j],L[k]
      if a!=b and a!=c and b!=c and a+b>c:
        ans+=1
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
if a<0 and b<0:
    if (b-a)%2 == 0:
        print("Negative")
    else:
        print("Positive")
elif a <= 0 and b >= 0:
    print("Zero")
else:
    print("Positive")
# Judge status: Accepted
x,k,d=map(int,input().split())
x=abs(x)
if x>k*d:
  ans=x-k*d
else:
  n=x//d
  if (k-n)%2==0:
    ans=x-n*d
  else:
    ans=abs(x-(n+1)*d)
print(ans)
# Judge status: Wrong Answer
N,M = map(int,input().split(' '))
H = [int(i) for i in input().split(' ')]
AB = []
for i in range(M):
    A,B = map(int,input().split(' '))
    AB.append(max(H[A-1],H[B-1]))
print(len(set(AB)))
# Judge status: Accepted
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

c=[input() for i in range(2)]
ans="YES"
if c[0][0]!=c[1][2]:
    ans="NO"
if c[0][1]!=c[1][1]:
    ans="NO"
if c[0][2]!=c[1][0]:
    ans="NO"
print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a + b + c < 22:
    print('win')
else:
    print('burst')
# Judge status: Accepted
N = int(input())
if N % 9 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def check():
  N = int(input())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  diff = sum(B)-sum(A)
  if diff < 0:
    return 'No'
  cnt = 0
  for i in range(N):
    cnt += max((B[i]-A[i]+1)//2,0)
  if diff < cnt:
    return 'No'
  return 'Yes'
print(check())
# Judge status: Wrong Answer
s = input()
if int(s[:4]) <= 2019:
  if int(s[5:7]) <= 4:
    if int(s[8:10]) < 30:
      print('Heisei')
    else:
      print('TBO')
  else:
    print('TBO')
else:
  print('TBO')
# Judge status: Accepted
def gcd(x, y):
    if x == 0: return y
    return gcd(y%x, x)
lcm = lambda x, y: x*y//gcd(x, y)

n, m = map(int, input().split())
arr = list(map(int, input().split()))
arr = [e//2 for e in arr]

cm = arr[0]
for e in arr[1:]:
    cm = lcm(cm, e)

if any([cm//e % 2 == 0 for e in arr]):
    print(0)
    exit()
print((m//cm+1)//2)
# Judge status: Wrong Answer
import math
n = int(input())
print(math.ceil(n/2)*n//2)
# Judge status: Accepted
x,a,b = map(int,input().split())
if abs(x-a)<abs(x-b):
    print('A')
else:
    print('B')
# Judge status: Accepted
a,b,c,d = map(int, input().split())

def solve(a,b,c,d):
    while True:
        c -= b
        if c <= 0:
            return "Yes"
        a -= d
        if a <= 0:
            return "No"

print(solve(a,b,c,d))
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()
cnt = [None] * N
cnt[0] = 0

for i in range(1, N):
    if S[i-1:i+1] == 'AC':
        cnt[i] = cnt[i-1] + 1
    else:
        cnt[i] = cnt[i-1]

ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(cnt[r-1] - cnt[l-1])

print('\n'.join(list(map(str, ans))))
# Judge status: Accepted
sx, sy, tx, ty = list(map(int, input().split()))
x = tx-sx
y = ty-sy
print('D', 'R'*(x+1), 'U'*(y+1), 'L', sep='', end='')
print('D'*y, 'L'*x, sep='', end='')
print('L', 'U'*(y+1), 'R'*(x+1), 'D', sep='', end='')
print('L'*x, 'D'*y, sep='')
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))
ans = 10**10
deck = sum(a)
su = 0
for i in range(0,N-1):
    su = su + a[i]
    ar = deck - su
    ans = min(ans, abs(su-ar))
print(ans)
# Judge status: Accepted
N, M  = map(int, input().split())
l=[]
for i in range(M):
    a, b = map(int, input().split())
    l.append(a)
    l.append(b)
for i in range(1, N+1):
    print(l.count(i))
# Judge status: Wrong Answer
n = int(input())
a = [int(_) for _ in input().split()]
a.sort()
print(sum(a[n:2*n]))
# Judge status: Accepted
import bisect

def snuke_festival(N,arr):
    n_pair = 0
    for item in arr[1]:
        up_pair = bisect.bisect_left(arr[0],item)
        down_pair = bisect.bisect_right(arr[2],item)
        n_pair += up_pair*(N-down_pair)
    return n_pair


if __name__ == "__main__":
    N  =int(input())
    arr = []
    for i in range(3):
        arr.append(list(map(int,input().split())))
    arr_sorted = []
    for j in range(3):
        arr_sorted.append(arr[j].sort())
    print(snuke_festival(N,arr))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(1,N):
    if A[i-1]>A[i]:
        ans+=A[i-1]-A[i]
        A[i]=A[i-1]
print(ans)
# Judge status: Wrong Answer
num = int(input())
ans = 0
for i in range(num):
  if(i%3!=0 and i%5!=0):
    ans += i 
print(ans)
# Judge status: Accepted
S = input()

def is_yymm(s):
    if 1<=int(s)<=12:
        return "both"
    else:
        return "YY"

left = is_yymm(S[:2])
right = is_yymm(S[2:])

ans = left + right

if ans=="YYboth":
    print("YYMM")
elif ans=="bothYY":
    print("MMYY")
elif ans=="bothboth":
    print("AMBIGUOUS")
else:
    print("NA")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
 
m = max(a)
a = sorted(a)
 
ans = 0
 
for i in a:
    if abs(m/2-i) < abs(m/2-ans):
        ans = i
 
print(m, ans)
# Judge status: Accepted
a, b = map(int, input().split())
print('Even' if a*b%2==0 else 'Odd')
# Judge status: Accepted
def S(M):
    return M * (M + 1) // 2

N = int(input())

print(S(N) - 3 * S(N // 3) - 5 * S(N // 5) + 15 * S(N // 15))
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(1, n):
    if h[i] <= h[i - 1]:
        cnt += 1
        ans = max(ans, cnt)
    else:
        cnt = 0
print(ans)
# Judge status: Wrong Answer
n = int(input())
nums = [int(input()) for _ in range(n)]
cnt = {}
for x in nums:
    if x in cnt:
        cnt[x] = 0
    else:
        cnt[x] = 1

print(sum(cnt.values()))
# Judge status: Accepted
n = int(input())
(*a,) = map(int, input().split())
(*b,) = map(int, input().split())
(*c,) = map(int, input().split())

ans = sum(c[a[i] - 1] for i in range(n - 1) if a[i + 1] - a[i] == 1)
print(ans + sum(b))
# Judge status: Accepted
n = input()
hon =[2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]

if int(n[-1]) in hon:
    print("hon")
elif int(n[-1]) in pon:
    print("pon")
else:
    print("bon")
# Judge status: Wrong Answer
from collections import Counter    
n = int(input())
s = input()
c = Counter(s)

total = 1
for v in c.values():
    total *= v
    
ct = 0
for i in range(n):
    for j in range(i + 1, n):
        k = j + j - i
        if k >= n:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ct += 1                

print(total-ct if total - ct > 0 else 0)
# Judge status: Accepted
X, A, B = map(int, input().split())
if B - A <= 0:
    print('delicious')
elif B - A <= X:
    print('safe')
else:
    print('dangerous')
# Judge status: Wrong Answer
N, *W = open(0).read().split()

is_ok = True

if len(W) != len(set(W)):
    is_ok = False
else:
    for i, w in enumerate(W):
        if i > 1:
            if before_w != w[0]:
                is_ok = False
                break
        
        before_w = w[-1]
    
if is_ok:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import collections

A = input()
B = input()

A_c = collections.Counter(A)
B_c = collections.Counter(B)
A_c = A_c.values()
B_c = B_c.values()

A_c = list(A_c)
B_c = list(B_c)
A_c.sort()
B_c.sort()
if A_c == B_c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x=list(input())
a=0
for i in x:
  a+=int(i)
if a%9==0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[1]:


N,K = map(int, input().split())
S = input()


# In[2]:


cnt = 1
for i in range(N-1):
    if S[i] != S[i+1]:
        cnt += 1
cnt = max(1,cnt-K*2)
print(N-cnt)


# In[ ]:
# Judge status: Wrong Answer
A,B,K=map(int,input().split())
l=[]
for i in range(max(A,B)):
    if A%(i+1)==0 and B%(i+1)==0: l.append(i+1)
l.sort(key=int)
print(l[K-1])
# Judge status: Accepted
N = int(input())
if N == 0:
    print('0')
    exit()

ans = ''
while abs(N) > 0:
    if abs(N) % 2 == 0:
        ans += '0'
        N //= 2
    else:
        N -= 1
        N //= 2
        ans += '1'
    N *= -1
print(ans[::-1])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
d = {}
e = 0
for ai in a:
  s = ai // 400
  if s > 7:
    e += 1
  else:
    if s in d:
      d[s] += 1
    else:
      d[s] = 1
print(max(1, len(d)), len(d) + e)
# Judge status: Wrong Answer
s = input()
a = int(s[0:2])
b = int(s[2:4])
if 0 < a <= 12 and 0 < b <= 12:
    print("AMBIGUOUS")
elif (a > 12 and b > 12) or a == 0 or b == 0:
    print("NA")
elif a > 12:
    print("YYMM")
else:
    print("MMYY")
# Judge status: Accepted
s, w = map(int, input().strip().split())
if w>=s:
    print("unsafe")
else:
    print("safe")
# Judge status: Wrong Answer
A,B,C,D = map(int,input().split())
while True:
  C = C - B
  if C <= 0:
    print('C:',C)
    break
  A = A - D
  if A <= 0:
    print('A:',A)
    break
print('Yes' if A >= C else 'no')
# Judge status: Accepted
N,M,K=map(int,input().split())
A=[0]+list(map(int,input().split()))
B=[0]+list(map(int,input().split()))
import itertools
A = list(itertools.accumulate(A))
B = list(itertools.accumulate(B))
ans=0
b=M
for a in range(N+1):
  if A[a]>K:
    break
  while  A[a]+B[b]>K:
    b-=1
  ans=max(ans,a+b)
print(ans)
# Judge status: Accepted
import math

num_of_even, num_of_odd = map(int, input().split())

def combinations_count(n, r):
    if n < 2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if num_of_even == 1 and num_of_odd == 1:
    print('0')
else:
    print(combinations_count(num_of_odd, 2) + combinations_count(num_of_even, 2))
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 1
ans += -(-(n-k)//(k-1))
print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

if a > c:
    a, c = c, a
if b > d:
    b, d = d, b
ans = b - c
if ans < 0:
    ans = 0

print(ans)
# 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
x,y=map(int,input().split())

cnt=1
a=x
while a<=y:
    if 2*a<=y:
        cnt+=1
    a=a*2

print(cnt)
# Judge status: Accepted
N = int(input())
A = [int(x) for x in input().split()]
A = [0] + A
B = []

i = N
if N%2==1:    
    for i in range(N, 0, -2):
        B.append(A[i])
    for i in range(2, N, 2):
        B.append(A[i])
else:
    for i in range(N, 1, -2):
        B.append(A[i])
    for i in range(1, N, 2):
        B.append(A[i])

print(*B)
# Judge status: Accepted
N, K = map(int, input().split())
prob = 0

for i in range(1, N+1):
    x = 0
    num = i * 2 ** x
    
    while (K > num):
        x += 1
        num = i * 2 ** x        
        
    prob += 1 / N * (1 / 2) ** x

print(prob)
# Judge status: Accepted
n,m=map(int, input().split())
s=0
for i in input().split():
    s=s+int(i)
if s>n:
    print("-1")
else:
    print(n-s)
# Judge status: Accepted
c = input()
print('vowel' if 'aeiou'.count(c) == 1 else 'consonant')
# Judge status: Wrong Answer
n,a = map(int,input().split())
print(a*(n-1)+n/2*(n-1)-1-n)
# Judge status: Accepted
#abc045 b
from collections import deque
sa=deque(list(input()))
sb=deque(list(input()))
sc=deque(list(input()))

tefuda=sa
win=""
while tefuda:
    c=tefuda.popleft()
    if c=="a":
        tefuda=sa
        win="A"
    if c=="b":
        tefuda=sb
        win="B"
    if c=="c":
        tefuda=sc
        win="C"
print(win)
# Judge status: Accepted
n=int(input())
s=input()

l=0
r=s[1:].count("E")
ans=r
MIN=r

for i in range(1,n):
    if s[i-1]=="W":
        ans+=1
    if s[i]=="E":
        ans-=1
    MIN=min(ans,MIN)
print(MIN)
# Judge status: Accepted
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
u = [[] for i in range(k)]
R=0
S=0
P=0

for i in range(n):
  u[i%k]+=t[i]

for i in range(k):
  l=len(u[i])
  for j in range(1,l):
    if u[i][j]==u[i][j-1]:
      u[i][j]='o'
  
  R+=u[i].count('s')
  S+=u[i].count('p')
  P+=u[i].count('r')

print(r*R+s*S+p*P)
# Judge status: Accepted
def comp(a,b):
    s = 0
    for i,j in zip(a,b):
        if not i == j:
            s += 1
    return s
 
s = input()
t = input()
ans = len(t)
 
for i in range(len(s) - len(t) + 1):
    score = comp(s[i:i+len(t)],t)
    if score == 0:
        ans = score
        break
    if ans > score:
        ans = score
 
print(ans)
# Judge status: Wrong Answer
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
dist = abs(A-B)
v = abs(W-V)
if T * v >= dist:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n, k = map(int, input().split())
s = input()
point = 0
tmp = 'N'
for i in s:
    if i == tmp: point += 1
    tmp = i
rl = s.count('RL')
lr = s.count('LR')
print(point + min(2 * k, rl + lr))
# Judge status: Accepted
a, b = map(int, input().split())
print("Odd" if a * b % 2 == 1 else "Even")
# Judge status: Accepted
n,x,y = map(int,input().split())

x = x-1
y = y-1

count_dict = {i : 0 for i in range(0, n)}

for i in range(n):
    for k in range(n):
        key = min(abs(i-k), abs(i-x)+abs(k-y) + 1, abs(i-y) +abs(k-x) + 1)
        count_dict[key] += 1

for i in range(1, n):
    print(count_dict[i] //2)
# Judge status: Accepted
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:])
        break
        
print(ans)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))
count=0
if n == 3:
  if p[0] < p[1] < p[2]:
    count+=1
else:
  for i in range(n-2):
    pp = p[0+i:3+i]
    if pp[0] < pp[1] < pp[2]:
      count+=1
print(count)
# Judge status: Wrong Answer
n,k=map(int,input().split())
h=[int(input()) for i in range(n)]
h.sort()
print(h)
ans=10**5
for i in range(n-k+1):
    print(h[i+k-1],h[i])
    ans=min(ans,h[i+k-1]-h[i])
    if ans==0:break
print(ans)
# Judge status: Accepted
A, B = map(int, input().split())
if (A+B) % 2 == 0:
  print((A+B)//2)
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
mod = 10**9 + 7
x, y = map(int, input().split())
move_count = 0
if (y + x) % 3 == 0:
    move_count = ((y + x) // 3)

move_a = (y - move_count) % mod
move_b = (x - move_count) % mod


def nck(n, k):
    numer, denom = 1, 1
    for i in range(k):
        numer = numer * (n - i) % mod
        denom = denom * (k - i) % mod
    return numer * pow(denom, mod-2, mod) % mod


ans = nck(move_count, min(move_a, move_b))
print(ans % mod)
# 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, M = map(int, input().split())
divisors = make_divisors(M)
print(max([x for x in divisors if x <= M // N]))
# Judge status: Accepted
a,b,c,d=input()
if a==b==c or b==c==d:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A,B=map(int,input().split())
A=(A+12)%14
B=(B+12)%14
if A==B: print("Draw")
elif A>B: print("Alice")
else: print("Bob")
# Judge status: Accepted
N = int(input())
l = [int(input()) for i in range(N)]

import collections

c = collections.Counter(l)
ans = 0
for i in c.values():
    if i % 2 != 0:
        ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = [a[i] - i - 1 for i in range(n)]
median = sorted(b)[n//2]

res = 0
for v in b:
    res += abs(v - median)
print(res)
# Judge status: Accepted
def solve():
    #start here
    n, W = map(int,input().split())
    l = []
    dp = [[0 for i in range(W+1)] for j in range(n)]
    for i in range(n):
        w, v = map(int,input().split())
        for j in range(1, W+1):
            if(w>j):
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = max(dp[i-1][j], v+dp[i-1][j-w])
    print(dp[n-1][W])
solve()
# Judge status: Wrong Answer
D, N = map(int, input().split())
print(N*100**D)
# Judge status: Accepted
n = int(input())

total = 0
for x in range(1,n+1):
    if len(str(x))%2 == 1:
        total += 1

print(total)
# Judge status: Accepted
o = list(input())
e = list(input())
for i in range(len(e)):
    print(o[i], end="")
    print(e[i], end="")
if(len(o)-len(e) == 1):
    print(o[-1], end="")
# Judge status: Accepted
S = input()

print( "ABC" if S=="ARC" else "ARC")
# Judge status: Accepted
from fractions import gcd

N=int(input())
T=[0]*N
S=[0]*N
for i in range(N):
  T[i]=int(input())

if N==1:
  print(T[0])
else:
  S[0]=T[0]
  for j in range(1,N):
    a=S[j-1]*T[j]
    S[j]=a//gcd(S[j-1],T[j])
  print(S[-1])
# Judge status: Wrong Answer
s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())
x = a-1,b
y = a,b-1
if s==u:
  print(x)
else:
  print(y)
# Judge status: Accepted
n,k,q = map(int, input().split())
a = [0]*n
for i in range(q):
  c = int(input())
  a[c-1] += 1
for i in range(n):
  print("Yes" if a[i] > q-k else "No")
# Judge status: Accepted
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
ans=""
for k in range(y):
    ans+="U"
for k in range(x+1):
    ans+="R"
for k in range(y+1):
    ans+="D"
for k in range(x+1):
    ans+="L"
ans+="U"
ans+="L"
for k in range(y+1):
    ans+="U"
for k in range(x+1):
    ans+="R"
for k in range(y+1):
    ans+="D"
for k in range(x):
    ans+="L"
print(ans)
# Judge status: Wrong Answer
AllInput = input("Enter Distance,Time Taken and Speed Separated by Space")
D,T,S= map(int,AllInput.split())

if (S*T) <= D:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
s = 0
for n in range(1, N + 1):
    if n % 3 == 0:
        continue
    if n % 5 == 0:
        continue
    s = s + n

print(s)