Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
import bisect

n = int(input())
*l, = map(int, input().split())
l = sorted(l)
count = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        c = bisect.bisect_left(l[j+1:], l[i]+l[j])
        count += c
print(count)

### FIXED CODE ###

import sys
import bisect

n = int(input())
*l, = map(int, input().split())
l.sort()
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        c = bisect.bisect_left(l, l[i] + l[j], j+1)
        ans += c - j - 1

print(ans)
### BUGGY CODE ###

A =[]
c = 0
for i in range(int(input())):
    A.append(sorted(list(input())))
    c += A.count(A[i])-1
print(c)

### FIXED CODE ###

A ={}
c = 0
for i in range(int(input())):
    a = str(sorted(input()))
    if a in A:
        A[a] += 1
        c += A[a]
    else:
        A[a] = 0
print(c)
### BUGGY CODE ###

n=int(input())
s=input()
l=n
for i in range(n):
  x=(s[0:i].count('W')+s[i+1:n].count('E'))
  if l>x:l=x
print(l)

### FIXED CODE ###

n=int(input())
s=input()
c=s[1:n].count('E')
l=[]
l.append(c)
for i in range(1,n):
  if s[i-1:i+1]=='WW':c+=1
  elif s[i-1:i+1]=='EE':c-=1
  l.append(c)
print(min(l))
### BUGGY CODE ###

import bisect

N = int(input())
a = list(map(int,input().split(' ')))
a.sort()

def do(n,fathers):
       
    if n == N:
        return
    
    sons = list()
    for father in fathers:
        son = a.pop(bisect.bisect_left(a,father)-1)
        
        if son >= father:
            return
        else:
            sons.append(son)

    fathers.extend(sons)
    do(n+1,fathers)
    


fathers = [a.pop()]
do(0, fathers) 

if len(fathers) == 2**N:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

N = int(input())
A = sorted((int(x) for x in input().split()))
 
parent = [A[-1]]
rest = A[:-1]
bl = True
for _ in range(N):
    next_parent = []
    next_rest = []
    for p in parent[::-1]:
        while rest:
            x = rest.pop()
            if x < p:
                next_parent.append(x)
                break
            else:
                next_rest.append(x)
                continue
    parent += next_parent
    parent.sort()
    rest = rest + next_rest[::-1]
 
bl = len(parent) == (2**N)
answer = 'Yes' if bl else 'No'
print(answer)
### BUGGY CODE ###

def main():
    N = int(input())
    A_list = [A for A in input().split()]
    A_list = list(map(int, A_list))
    #ans_list = []

    for n_cycle in range(N) :
        n_cycle = n_cycle + 1
        #ans_list.append(A_list.count(n_cycle))
        print(A_list.count(n_cycle))
    #for ans in ans_list :
    #    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from collections import Counter
    N = int(input())
    A_list = [A for A in input().split()]
    A_list = list(map(int, A_list))
    #ans_list = []
    ans = Counter(A_list)

    for n_cycle in range(N) :
        n_cycle = n_cycle + 1
        #ans_list.append(A_list.count(n_cycle))
        print(ans[n_cycle])

if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())

s = input().split(" ")

judge = False

for i in range(N):

  if s.count(s[i]) > 1:
      judge = True

if judge == True:
  print("NO")
else:
  print("YES")







### FIXED CODE ###

N = int(input())

s = input().split(" ")

b = len(s)

s = set(s)

a = len(s)



if a == b:
  print("YES")
else:
  print("NO")
### BUGGY CODE ###

n = int(input())
A = map(int, input().split())
l = []
for a in A:
    l.append(a)
    l.reverse()
print(' '.join(map(str, l)))

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
print(' '.join(map(str, A[::-2])), ' '.join(map(str, A[n%2::2])))
### BUGGY CODE ###

buf = input().split()
N = int(buf[0])
M = int(buf[1])
Q = int(buf[2])
import numpy as np
train = np.zeros((N+1, N+1))
for i in range(M):
	buf = input().split()
	train[int(buf[0])][int(buf[1])] += 1
for i in range(Q):
	buf = input().split()
	p = int(buf[0])
	q = int(buf[1])
	print(int(np.sum(train[p:q+1, p:q+1])))

### FIXED CODE ###

import numpy as np
N, M, Q = map(int, input().split())

train = np.zeros((N, N))
for i in range(M):
	L, R = map(int, input().split())
	train[N-L][R-1] += 1
train = np.cumsum(np.cumsum(train, axis=0), axis=1)

for _ in range(Q):
	p, q = map(int, input().split())
	print(int(train[N-p][q-1]))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
S = input()
dict_amari = {}
count = 0

henkan = {i: [(10*j+i)%2019 for j in range(2019)] for i in range(1,10)}

def amari_new(dict_amari, s, henkan):
  dict_amari_new = {henkan[k] : v for k,v in dict_amari.items()}
  if s in dict_amari_new.keys():
    dict_amari_new[s] += 1
  else:
    dict_amari_new[s] = 1
  return dict_amari_new

for s in S:
  dict_amari = amari_new(dict_amari, int(s), henkan[int(s)])
  if 0 in dict_amari.keys():
    count += dict_amari[0]

print(count)


### FIXED CODE ###

# -*- coding: utf-8 -*-
S = input()
list_amari = [0 for i in range(2019)]
amari_prev = 0
X = 1

for i in range(len(S)):
  amari = (int(S[-i-1])*X+amari_prev)%2019
  list_amari[amari] += 1
  amari_prev = amari
  X = (10*X)%2019

count = list_amari[0]
for v in list_amari:
  count += v*(v-1)//2

print(count)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=[0 for _ in range(n)]
for i in range(n):
    ans[i]=a.count(i+1)
print('\n'.join(map(str,ans)))

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=[0 for _ in range(n)]
for i in range(n-1):
    ans[a[i]-1]+=1
print(*ans,sep='\n')
### BUGGY CODE ###

from collections import defaultdict
from math import gcd

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

num = 10 ** 6
primes = [0] * (num + 1)
primes[0] = 1
primes[1] = 1

for i in range(2, num + 1):
    if primes[i] != 0:
        continue

    cnt = 1
    while i * cnt <= num:
        primes[i * cnt] = i
        cnt += 1


def func(n):
    res_dic = defaultdict(int)
    while n > 1:
        x = primes[n]
        res_dic[x] += 1
        n //= x

    return res_dic


pairwise = True
cnt_dic = defaultdict(int)
for a in A:
    dic = func(a)

    for k in dic.keys():
        cnt_dic[k] += 1
        if cnt_dic[k] > 1:
            pairwise = False
            break

g = A[0]
for a in A[1:]:
    g = gcd(g, a)

if pairwise:
    print('pairwise coprime')
elif g == 1:
    print('setwise coprime')
else:
    print('not coprime')



### FIXED CODE ###

from collections import defaultdict
from math import gcd

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

num = 10 ** 6
primes = [0] * (num + 1)
primes[0] = 1
primes[1] = 1

for i in range(2, num + 1):
    if primes[i] != 0:
        continue

    cnt = 1
    while i * cnt <= num:
        primes[i * cnt] = i
        cnt += 1


def func(n):
    res_dic = defaultdict(int)
    while n > 1:
        x = primes[n]
        res_dic[x] += 1
        n //= x

    return res_dic


pairwise = True
cnt_dic = defaultdict(int)
for a in A:
    dic = func(a)

    for k in dic.keys():
        cnt_dic[k] += 1
        if cnt_dic[k] > 1:
            pairwise = False
            break

g = A[0]
for a in A[1:]:
    g = gcd(g, a)

if pairwise:
    print('pairwise coprime')
elif g == 1:
    print('setwise coprime')
else:
    print('not coprime')
### BUGGY CODE ###

s = input()
t = input()
s_len = len(s)
t_len = len(t)

# dp[i][j] = sのi文字目、tのj文字目までの最大長の部分文字列
dp = [['' for j in range(t_len + 1)] for i in range(s_len + 1)]
for si in range(1, s_len + 1):
    for ti in range(1, t_len + 1):
        if s[si - 1] == t[ti - 1]:
            if len(dp[si][ti]) < len(dp[si - 1][ti - 1] + s[si - 1]):
                dp[si][ti] = dp[si - 1][ti - 1] + s[si - 1]
        if len(dp[si][ti]) < len(dp[si - 1][ti]):
            dp[si][ti] = dp[si - 1][ti]
        if len(dp[si][ti]) < len(dp[si][ti - 1]):
            dp[si][ti] = dp[si][ti - 1]
print(dp[s_len][t_len])


### FIXED CODE ###

def dump(dp, i1_max, i2_max):
    for i1 in range(0, i1_max + 1):
        for i2 in range(0, i2_max + 1):
            print('%4d' % dp[i1][i2], end='')
        print()


s = input()
t = input()
s_len = len(s)
t_len = len(t)
inf = 1 << 60

# dp[i][j] = sのi文字目、tのj文字目までの最大長の部分文字列
dp = [[-inf for j in range(t_len + 1)] for i in range(s_len + 1)]
dp[0][0] = 0
for si in range(0, s_len + 1):
    for ti in range(0, t_len + 1):
        if si >= 1 and ti >= 1:
            if s[si - 1] == t[ti - 1]:
                dp[si][ti] = max(dp[si][ti], dp[si - 1][ti - 1] + 1)
        if si >= 1:
            dp[si][ti] = max(dp[si][ti], dp[si - 1][ti])
        if ti >= 1:
            dp[si][ti] = max(dp[si][ti], dp[si][ti - 1])

ans = ''
si = s_len
ti = t_len
#dump(dp, si, ti)
while si != 0 and ti != 0:
    if si >= 1 and ti >= 1:
        if (dp[si - 1][ti - 1] == dp[si][ti] - 1) and s[si - 1] == t[ti - 1]:
            ans = s[si - 1] + ans
            si -= 1
            ti -= 1
            continue
        if dp[si - 1][ti - 1] == dp[si][ti]:
            si -= 1
            ti -= 1
            continue
    if si >= 1:
        if dp[si - 1][ti] == dp[si][ti]:
            si -= 1
            continue
    if ti >= 1:
        if dp[si][ti - 1] == dp[si][ti]:
            ti -= 1
            continue

print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N = int(raw_input())
li = map(int, raw_input().split())

move_max = 0
tmp = 0

for i in xrange(N):
	move = 0
	tmp = li[i]
	for j in xrange(i+1,N):
		if tmp >= li[j]:
			tmp = li[j]
			move += 1
		else:
			break
	if move > move_max:
		move_max = move

print move_max

### FIXED CODE ###

n = int(raw_input())
a = map(int, raw_input().split())
 
ans = 0
temp = 0
for i in xrange(n-1):
    if a[i] >= a[i+1]:
        temp = temp + 1
    else:
        ans = max(ans, temp) 
        temp = 0
 
print max(ans, temp)
### BUGGY CODE ###

S=input()
# S="".join(["1" for _ in range(10**5)])
# S = "??2??5"
# S= "?44"

MOD = 10**9+7
dp = {}
for i in range(13):
    dp[(-1,i)] = 0
dp[(-1,0)] = 1
for t,ss in enumerate(S[::-1]):
    if t==0:
        tt = 1
    else:
        tt = (10*tt)%13
    for i in range(13):
        dp[(t,i)] = 0
    if ss=="?":
        for i in range(13):
            for j in range(10):
                k = (t,(j*tt+i)%13)
                dp[k] += dp[(t-1,i)]
                dp[k] %= MOD
    else:
        s = int(ss)
        for i in range(13):
            k = (t,(s*tt+i)%13)
            dp[k] += dp[(t-1,i)]
            dp[k] %= MOD

print(dp[(t,5)])

### FIXED CODE ###

S=input()
# S="".join(["?" for _ in range(10**5)])
# S = "??2??5"
# S= "?44"

MOD = 10**9+7
dp = [[0 for i in range(13)] for j in range(len(S)+1)]
dp[0][0] = 1
for t,ss in enumerate(S[::-1]):
    if t==0:
        tt = 1
    else:
        tt = (10*tt)%13
    if ss=="?":
        for i in range(13):
            for j in range(10):
                k = (j*tt+i)%13
                dp[t+1][k] += dp[t][i]%MOD
    else:
        s = int(ss)
        for i in range(13):
            k = (s*tt+i)%13
            dp[t+1][k] += dp[t][i]%MOD

print(dp[t+1][5]%MOD)
### BUGGY CODE ###

n = input()
nums = [int(e) for e in input().split()]
# print(nums)

ans = 1

for i in nums:
  ans = ans * i

s = 10**18

if(ans > s):
  print('-1')

else:
  print(ans)

### FIXED CODE ###

import sys
n = input()
nums = [int(e) for e in input().split()]

if 0 in nums:
  print('0')
  sys.exit()

ans = 1
s = 10**18

for i in nums:
  ans = ans * i
  if(ans > s):
    print('-1')
    break


if(ans <= s):
  print(ans)
### BUGGY CODE ###

from collections import* #defaultdict Counter deque appendleft
import sys
input=sys.stdin.readline
import functools
@functools.lru_cache(maxsize=None)

def main():
    n=int(input())
    d=defaultdict(deque)
    for i in range(n):
        d[i+1]=deque(map(int,input().split()))

    c=0
    immortalskip=set()
    while any(d.values()):
        c+=1
        f=0
        skip=set()
        for i in range(1,n+1):
            if i not in skip.copy() and i not in immortalskip:
                if d[i]:
                    if d[i][0] in skip:
                        continue
                    elif i==d[d[i][0]][0]:
                        oppo=d[i].popleft()
                        d[oppo].popleft()
                        skip.add(oppo)
                        skip.add(i)
                        f=1
                else:
                    immortalskip.add(i)
        if not f:
            print(-1)
            exit()

    print(c)

if __name__ == '__main__':
    main()



### FIXED CODE ###

from collections import* #defaultdict Counter deque appendleft
import sys
input=sys.stdin.readline
import time
t=time.time()

def main():
    n=int(input())
    d=[[]]+[deque(map(int,input().split()))for i in n*[0]]

    c=0
    while any(d):
        c+=1
        f=0
        skip=set()
        for i in range(1,n+1):
            if i not in skip:
                if d[i]:
                    if d[i][0] in skip:
                        continue
                    elif i==d[d[i][0]][0]:
                        oppo=d[i].popleft()
                        d[oppo].popleft()
                        skip.add(oppo)
                        skip.add(i)
                        f=1

        if not f:
            print(-1)
            exit()
        if abs(time.time()-t)>1:
            print(n*(n-1)//2)
            exit()

    print(c)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import numpy as np
N = int(input())
A = list(map(int,input().split()))

mi = min(A)

def mak(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list
    
P = mak(mi)[1:][::-1]
lenp = len(P)

Q = np.array(A)

an = 1
flag = 0
for i in range(lenp):
    R = Q % P[i]
    if any(R) == 0:
        if flag == 1:
            flag = 0
            continue
        an = P[i]
        break
    else:
        if i != lenp - 1:
            if max(R) < P[i+1]:
                flag = 1
        Q = R
print(an)

### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int,input().split()))
flag = 0
#mi = min(A)
Q = np.array(A)
an = 1
def toku(Q):
    mi = min(Q)
    R1 = Q % mi
    if any(R1) == 0:
        flag = 1
        an = mi
        return flag, an, R1
    else:
        flag = 0
        an = 1
        ind = np.argmin(Q)
        R1[ind] = mi
        R = R1[R1!=0]
        return flag, an, R

while flag == 0:
    flag,an,PP = toku(Q)
    Q = PP

print(an)
### BUGGY CODE ###

N,M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
def wb(X,Y):
    return int(X/(2**Y))
while M > 0:
    A[0] /= 2
    M -= 1
    A = sorted(A, reverse=True)
ans = 0
for i in A:
    ans += int(i)
print(ans)

### FIXED CODE ###

N,M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] *= -1
import heapq
heapq.heapify(A)
for i in range(M):
    m = heapq.heappop(A)
    heapq.heappush(A,-1*(-m//2))
print(-1*sum(A))
### BUGGY CODE ###

N, K =map(int, input().split())
p = list(map(int, input().split()))

ans = 0
for i in range(N-K+1):
  exp = sum(p[i:i+K])
  if exp >= ans:
    ans = exp

    
print((ans+K)/2)

### FIXED CODE ###

def cal(x): return (x+1)/2

N, K = map(int, input().split())
p = list(map(int, input().split()))

ans  = sum(cal(p[i]) for i in range(K))
    
cnt = ans

for i in range(K, N):
  cnt = cnt-cal(p[i-K])+cal(p[i])
  ans = max(cnt, ans)
print(ans)
### BUGGY CODE ###

from collections import deque


def solvemaze(y, x, num):
    maps.append([])
    dx, dy = (-1, 0, 1, 0), (0, -1, 0, 1)
    maze[y][x] = num
    que = deque()
    que.append((y, x))
    while que:
        y_, x_ = que.popleft()
        maps[num].append((y_, x_))
        for i in range(4):
            y2 = y_ + dy[i]
            x2 = x_ + dx[i]
            if 0 <= y2 < h and 0 <= x2 < w and maze[y2][x2] == '.':
                maze[y2][x2] = num
                que.append((y2, x2))

def makeroute(s_maps, num):
    res = []
    for y, x in s_maps:
        for i in range(-2, 3):
            for j in range(-2, 3):
                y2 = y + i
                x2 = x + j
                if 0 <= y2 < h and 0 <= x2 < w and not maze[y2][x2] in (num,'#') and not maze[y2][x2] in res:
                    res.append(maze[y2][x2])
    
    return res
        

def dijkstra(s, g):
    que = deque()
    d = [float('inf')] * num
    d[s] = 0
    que.append((0, s))
    while que:
        cost, v = que.popleft()
        if d[v] < cost:
            continue
        for i in range(len(E[v])):
            e = E[v][i]
            if d[e] > d[v] + 1:
                d[e] = d[v] + 1
                que.append((d[e], e))
    
    if d[g] == float('inf'):
        return -1
    return d[g]
    

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
maze = [[x for x in input()] for _ in range(h)]
maps = []

num = 0
for i in range(h):
    for j in range(w):
        if maze[i][j] == '.':
            solvemaze(i, j, num)
            num += 1

E = [[] for _ in range(num)]
for i in range(num):
    E[i] = makeroute(maps[i], i)

s = maze[Ch-1][Cw-1]
g = maze[Dh-1][Dw-1]
print(dijkstra(s, g))

### FIXED CODE ###

from collections import deque


h, w = map(int, input().split())
Ch, Cw = map(lambda x: int(x)-1, input().split())
Dh, Dw = map(lambda x: int(x)-1, input().split())
dy, dx = (-1, 0, 1, 0), (0, -1, 0, 1)
maze = [[float('inf') if x == '.' else -float('inf') for x in input()] for _ in range(h)]
maze[Ch][Cw] = 0
que = deque()
que.append((0, Ch, Cw))
while que:
    c, y, x = que.popleft()
    
    if c > maze[y][x]:
        continue
    
    if y == Dh and x == Dw:
        break
    
    for i in range(4):
        y2, x2 = y + dy[i], x + dx[i]
        if 0 <= y2 < h and 0 <= x2 < w and c < maze[y2][x2]:
            maze[y2][x2] = c
            que.appendleft((c, y2, x2))
            
    for i in range(-2, 3):
        for j in range(-2, 3):
            y3, x3, c2 = y + i, x + j, c+1
            if 0 <= y3 < h and 0 <= x3 < w and c2 < maze[y3][x3]:
                maze[y3][x3] = c2
                que.append((c2, y3, x3))

ans = maze[Dh][Dw]
if ans == float('inf'):
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

import collections

S = list(input())
a=[int(x) for x in S] #int型のリストに変換
a.reverse()
#print(a)

n=len(a)
T=[0]*n
L=[0]*n

T[0]=a[0]
L[0]=a[0]
for i in range(1,n):
    T[i]=T[i-1]+(a[i]*10**i)
    L[i]=T[i]%2019

#print(T)


#print(L)
c = collections.Counter(L)

#出現回数が2回以上のものの出現数 + 0の出現回数
print(int(len([i[0] for i in c.items() if i[1] >= 2])) + int(len([i for i in L if i==0])))

### FIXED CODE ###

S = list(input())
a=[int(x) for x in S] #int型のリストに変換
a.reverse()
#print(a)
l=[0]*2019
l[0]=1
T=0
d=1

for i in a:
    T+=(int(i)*d)
    T%=2019
    l[T]+=1
    d*=10
    d%=2019
result=0
for n in l:
    result+=n*(n-1)/2
print(int(result))
### BUGGY CODE ###

A, B, N = map(int, input().split())

# x=0の場合、値は0
ans = 0
# x=1～Nについて
for x in range(1, N+1):
    if (A*x)//B - A*(x//B) > ans:
        ans = (A*x)//B - A*(x//B)
        
print(ans)

### FIXED CODE ###

A, B, N = map(int, input().split())

if N>=B:
    print(A*(B-1)//B)
else:
    print(A*N//B)
### BUGGY CODE ###

n=int(input())
x = [int(i) for i in input().split()]
mul=1
check=10**18
for i in range(n):
    mul*=int(x[i])
if(check<mul):
    print("-1")
else:
    print(mul)

### FIXED CODE ###

n=int(input())
x = [int(i) for i in input().split()]
mul=1
check=10**18
count=x.count(0)
if(count>=1):
    print("0")
else:
    for i in range(n):
        mul*=int(x[i])
        if(check<mul):
            break
    if(check<mul):
        print("-1")
    else:
        print(mul)
### BUGGY CODE ###

from sys import stdin
import numpy as np
def main():
    #入力
    readline=stdin.readline
    n,k=map(int,readline().split())
    h=np.array(list(map(int,readline().split())),dtype=np.int64)
    before=np.arange(1,k+1,dtype=np.int64)
    zero=np.zeros(k,dtype=np.int64)

    dp=np.zeros(n,dtype=np.int64)
    for i in range(n):
        tmp=np.maximum(zero,i-before)
        dp[i]=(dp[tmp]+np.abs(h[i]-h[tmp])).min()

    print(dp[n-1])

if __name__=="__main__":
    main()

### FIXED CODE ###

def main():
    N,K=map(int,input().split())
    h=list(map(int,input().split()))
    dp=[10**10]*N
    dp[0]=0
    for i in range(N):
        for j in range(1,min(K+1,N-i)):
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
    print(dp[N-1])

if __name__=="__main__":
    main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n, k = map(int, input().split())
a = list(map(int, input().split()))
r = 0
x = 0.0
max = 0
for i in range(n-k+1):
  sum = 0
  for j in range(k):
    sum += a[i+j]
  if max < sum:
    max = sum
    r = i
for j in range(k):
  d = a[r+j]
  x += (((d+1)*d)/2)/d
print(x)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = {}
r = s = m = 0
for i in range(k):
  s += a[i]
  if a[i] in b:
    pass
  else:
    d = a[i]
    b[d] = (d+1)/2.0
m = s
    
for i in range(n-k):
  s = s - a[i] + a[k+i]
  if a[k+i] in b:
    pass
  else:
    d = a[k+i]
    b[d] = (d+1)/2.0
  if m < s:
    m = s
    r = i+1
    
sp = 0.0
for i in range(k):
  sp += b[a[r+i]]
print(sp)
### BUGGY CODE ###

from functools import reduce
import math

def main():
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N,K = (int(_) for _ in input().split())
    S = list(int(_) for _ in input())
    now = 1
    cnt = 0
    Nums = []
    ans = 0
    for i in range(N):
        if(S[i]==now):
            cnt+=1
        else:
            Nums.append(cnt)
            now = 1 - now
            cnt=1
    if(cnt!=0):
        Nums.append(cnt)
    if(len(Nums)%2 == 0):
        Nums.append(0)
    Add = 2 * K +1
    for i in range(0,len(Nums),2):
        tmp = 0
        left = i
        right = min(i+Add,len(Nums))
        for j in range(left,right):
            tmp += Nums[j]
        ans = max(tmp,ans)
    print(ans)
    
if __name__ == '__main__':
    main()


### FIXED CODE ###

from functools import reduce
import math

def main():
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N,K = (int(_) for _ in input().split())
    S = list(int(_) for _ in input())
    now = 1
    cnt = 0
    Nums = []
    ans = 0
    left = 0
    right = 0
    tmp = 0
    for i in range(N):
        if(S[i]==now):
            cnt+=1
        else:
            Nums.append(cnt)
            now = 1 - now
            cnt=1
    if(cnt!=0):
        Nums.append(cnt)
    if(len(Nums)%2 == 0):
        Nums.append(0)
    Add = 2 * K +1
    for i in range(0,len(Nums),2):
        Nextleft = i
        Nextright = min(i+Add,len(Nums))
        
        while(Nextleft>left):
            tmp -= Nums[left]
            left +=1
        while(Nextright>right):
            tmp += Nums[right]
            right +=1        
        ans = max(tmp,ans)
    print(ans)
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

flag = True
for k in range(max(A, B)):
  if abs(A - k) == abs(B - k):
    print(k)
    flag = False

if flag:
  print("IMPOSSIBLE")

### FIXED CODE ###

A, B = map(int, input().split())
     
if (A + B) % 2 == 0:
  print((A + B) // 2)
else:
  print("IMPOSSIBLE")