Harryxun/stf_run huggingface dataset:
import heapq

N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = []

x1, k1, l1, lim1 = 0, K, [], N
if lim1 > K:
    lim1 = K
lim1 += 1
for i in range(lim1):
    ans.append(sum(l1[min(k1, x1):]))
    x2, k2, l2, lim2 = x1, k1, l1[:], N - i
    if lim2 > k2:
        lim2 = k2 + 1
    for vr in V[:-lim2:-1]:
        k2 -= 1
        heapq.heappush(l2, vr)
        if vr <= 0:
            x2 += 1
        ans.append(sum(l2[min(k2, x2):]))
    vl = V[i]
    k1 -= 1
    heapq.heappush(l1, vl)
    if vl <= 0:
        x1 += 1
print(max(ans))

### FIXED CODE ###

from bisect import insort_right as ir

N, K = list(map(int, input().split()))
V = list(map(int, input().split()))
ans = [0]

def right(x, k, l, lim):
    if lim > k:
        lim = k
    for vr in V[::-1][:lim]:
        k -= 1
        ir(l, vr)
        if vr <= 0:
            x += 1
        ans.append(sum(l[min(k, x):]))    

x1, k1, l1, lim1 = 0, K, [], N
if lim1 > K:
    lim1 = K
right(0, K, [], N - 1)
for vl in V[:lim1]:
    k1 -= 1
    ir(l1, vl)
    if vl <= 0:
        x1 += 1
    ans.append(sum(l1[min(k1, x1):]))
    x2, k2, l2, lim2 = x1, k1, l1[:], N + k1 - K
    right(x2, k2, l2, lim2)
ans.append(sum(l1[min(k1, x1):]))
print(max(ans))
A,B = map(int,input().split())  
if A + B < 10:
  prin(A+B)
else:
  print('error')

### FIXED CODE ###

A,B = map(int,input().split())  
if A + B >= 10:
  print('error')
else:
  print(A+B)
import sys
import numpy as np
import collections
n,k = [int(x) for x in sys.stdin.readline().split()]
r = np.zeros(10**5)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
c = 0
for i,j in enumerate(r):
	c += j
	if c >= k:
		print(i)
		break

### FIXED CODE ###

import sys
import numpy as np
import collections
n,k = [int(x) for x in sys.stdin.readline().split()]
r = collections.defaultdict(int)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
d = sorted(r.items())
c = 0
for i,j in enumerate(d):
	c += j[1]
	if c >= k:
		print(int(j[0]))
		break
# -*- coding: utf-8 -*-

# スペース区切りの整数の入力
a, b = map(int, input().split())

c = a*b

# 出力
if (c%2==0)
	print("Even")
else
	print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
import math
from fractions import gcd

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

n = math.gcd(a, b)

if n == 1:
  print(a*b)
else:
  a = a//n
  print(a*b)


### FIXED CODE ###

import fractions

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

n = fractions.gcd(a, b)

if n == 1:
  print(a*b)
else:
  a = a//n
  print(a*b)
s=raw_input()
print "First"if len(s)%2^s[0]==s[-1]else"Second"

### FIXED CODE ###

s=raw_input()
print"First"if len(s)%2^int(s[0]==s[-1])else"Second"
print(int(input())*int(input()))

### FIXED CODE ###

A, B = list(map(int, input().split()))
print(A*B)
n, m = map(int, input().split())


root = list(range(n + 1))


from collections import defaultdict
d = defaultdict(set)



def find(i):
    if i == root[i]:
        return i
    root[i] = find(root[i])
    return root[i]

def union(u, v):
    fu, fv = find(u), find(v)
    if fu == fv:
        d[min(fu, fv)].add(max(u, v))
        return
    root[max(u, v)] = min(fu, fv)
    # root[u] = fv
    d[min(fu, fv)].add(max(u, v))



for i in range(m):
    u, v = map(int, input().split())
    union(u, v)



# print(d)
print(max(map(len, d.values())) + 1)


### FIXED CODE ###

n, m = map(int, input().split())


root = list(range(n + 1))


# from collections import defaultdict
# d = defaultdict(set)
cnt = [1] * (n + 1)


def find(i):
    if i == root[i]:
        return i
    root[i] = find(root[i])
    return root[i]

def union(u, v):
    fu, fv = find(u), find(v)
    if fu == fv:
        return
    cnt[min(fu, fv)] += cnt[max(fu, fv)]
    root[max(fu, fv)] = min(fu, fv)



for i in range(m):
    u, v = map(int, input().split())
    union(u, v)



# print(d)
print(max(cnt))
import sys,bisect as bs,collections as cl
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

p = l()

p.sort(reverse = True)

ms = p[0]
s = [p[0]]

for i in range(n):
    count = 0
    local = 0
    s.sort(reverse = True)
    while count < 2**i:
        if local >= 2**n:
            print("No")
            exit()
        if s[i] > p[local]:
            s.append(p[local])
            p[local] = mS
            count += 1
        local += 1
print("Yes")





### FIXED CODE ###

import sys,bisect as bs,collections as cl
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

p = l()

p.sort(reverse = True)

ms = p[0]
s = [p[0]]

for i in range(n):
    count = 0
    local = 0
    s.sort(reverse = True)
    while count < 2**i:
        if local >= 2**n:
            print("No")
            exit()
        if s[count] > p[local]:
            s.append(p[local])
            p[local] = ms
            count += 1
        local += 1
print("Yes")
W, H, x, y = map(int, input().split())

ans = [min(x, W - x) * H, min(y, H - y) * W]

if y / x == H / W:
    print(W * H / 2, 1)
elif (x == 0 and y == 0) or (x == W and y == 0) or (x == 0 and y == H) or (x == W and y == H):
    print(W * H / 2, 0)
else:
    print(max(ans), int(ans[0] == ans[1]))


### FIXED CODE ###

W, H, x, y = map(int, input().split())

print(W * H / 2, 1 if W / 2 == x and H / 2 == y else 0)
from collections import Counter
lst=[]
for i in range(int(input())):
  lst.append(input())
dic=dict(Counter(lst))
for i in ['AC','WA','TLE','RE']:
  print(f'{i} × {dic[i]}')

### FIXED CODE ###

from collections import Counter
lst=[]
for i in range(int(input())):
  lst.append(input())
dic=dict(Counter(lst))
for i in ['AC','WA','TLE','RE']:
  try:
    print(f'{i} x {dic[i]}')
  except KeyError:
    print(f'{i} x 0')
N, K = map(int, input().split())
V = [int(i) for i in input().split()]
ans = 0
for M in range(K+1):
    for m in range(M+1):
        ls = []
        cur1 = 0
        for i, x in enumerate(V):
            if i < m:
                ls.append(x)
                cur += 1
        cur2 = 0
        for i, x in enumerate(V[::-1]):
            if i < min(M-m, N-cur1):
                ls.append(x)
                cur2 += 1
        ls.sort()
        s = sum(ls)
        for i, x in enumerate(ls):
            if i < K-(cur1+cur2):
                s -= x
        ans = max(ans, s)
print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
V = [int(i) for i in input().split()]
ans = 0
for M in range(K+1):
    for m in range(M+1):
        ls = []
        for i, x in enumerate(V):
            if i < m:
                ls.append(x)
        for i, x in enumerate(V[::-1]):
            if i < min(M-m, N-m):
                ls.append(x)
        ls.sort()
        s = sum(ls)
        for i, x in enumerate(ls):
            if i < K-M and x < 0:
                s -= x
        ans = max(ans, s)
print(ans)
N = int(input())
a = input().split()
num=[]
tex=[]
count
for i in range(N):
	num.append(int(a[i]))
	if num[i] < 0 :
		count +=1
	elif num[i] == 0:
		count2 +=1
if count%2 ==0 or count2 > 0:
  res = sum(num)
else:tex=[i for i, x in enumerate(num) if x <0]
  res =sum(num)-min(tex[0],tex[-1])
print(res)


### FIXED CODE ###

N = int(input())
a = input().split()
num=[]
numabs=[]
tex=[]
count=0
count2=0
for i in range(N):
	num.append(int(a[i]))
	numabs.append(abs(num[i]))
	if num[i] < 0 :
		count +=1
	elif num[i] == 0:
		count2 +=1
if count%2 ==0 or count2 > 0:
	res = sum(numabs)
else:
	res =sum(numabs)-2*min(numabs)
print(res)
N = int(input())
arr = [int(input() for i in range(N))]
print(sum(arr) - max(arr)//2)

### FIXED CODE ###

N = int(input())
arr = [int(input()) for i in range(N)]
print(sum(arr) - max(arr)//2)
A=int(input())
B=int(input())
C=int(input())
if A==B==C:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

A,B,C=map(int,input().split())
if A==B==C:
    print('Yes')
else:
    print('No')
N, Q  = [int(a) for a in input().split()]
s = input()
s_dict = {c:[] for c in set('ABCDEFGHIJKLMNOPQRSTUVWXYZ')}
for i, c in enumerate(s):
    s_dict[c].append(i+1)
g = [1] * (N+2)

for _ in range(Q):
    row = input()
    c, lr = row.split()
    for i in s_dict[c]:
        mover = g[i]
        g[i] -= mover
        if lr == 'L':
            g[i-1] += mover
        else:
            g[i+1] += mover

print(sum(g[1:-1]))

### FIXED CODE ###

A, B, C  = [int(a) for a in input().split()]
if A == B == C:
    print('Yes')
else:
    print('No')
import numpy as np

area = [[0 for i in range(10)] for j in range(10)]
area = np.array(area)

while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break

    if s == 3:
        if (0 <= x+2 <= 9) and (0 <= y <= 9):
            area[x+2][y] += 1
        if (0 <= x <= 9) and (0 <= y+2 <= 9):
            area[x][y+2] += 1
        if (0 <= x-2 <= 9) and (0 <= y <= 9):
            area[x-2][y] += 1
        if (0 <= x <= 9) and (0 <= y-2 <= 9):
            area[x][y-2] += 1
    if s >= 2:
        if (0 <= x+1 <= 9) and (0 <= y+1 <= 9):
            area[x+1][y+1] += 1
        if (0 <= x+1 <= 9) and (0 <= y-1 <= 9):
            area[x+1][y-1] += 1
        if (0 <= x-1 <= 9) and (0 <= y+1 <= 9):
            area[x-1][y+1] += 1
        if (0 <= x-1 <= 9) and (0 <= y-1 <= 9):
            area[x-1][y-1] += 1
    if s >= 1:
        if (0 <= x+1 <= 9) and (0 <= y <= 9):
            area[x+1][y] += 1
        if (0 <= x <= 9) and (0 <= y+1 <= 9):
            area[x][y+1] += 1
        if (0 <= x-1 <= 9) and (0 <= y <= 9):
            area[x-1][y] += 1
        if (0 <= x <= 9) and (0 <= y-1 <= 9):
            area[x][y-1] += 1
        area[x][y] += 1

print(len(np.where(area == 0)[0]))
print(area.max())

### FIXED CODE ###

def check(x, y):
    return 0 <= x <= 9 and 0 <= y <= 9


def small(x, y, area):
    if check(x+1, y):
        area[x+1][y] += 1
    if check(x, y+1):
        area[x][y+1] += 1
    if check(x-1, y):
        area[x-1][y] += 1
    if check(x, y-1):
        area[x][y-1] += 1
    area[x][y] += 1
    return area


def mediam(x, y, area):
    area = small(x, y, area)
    if check(x+1, y+1):
        area[x+1][y+1] += 1
    if check(x+1, y-1):
        area[x+1][y-1] += 1
    if check(x-1, y+1):
        area[x-1][y+1] += 1
    if check(x-1, y-1):
        area[x-1][y-1] += 1
    return area


def large(x, y, area):
    area = mediam(x, y, area)
    if check(x+2, y):
        area[x+2][y] += 1
    if check(x, y+2):
        area[x][y+2] += 1
    if check(x-2, y):
        area[x-2][y] += 1
    if check(x, y-2):
        area[x][y-2] += 1
    return area

area = [[0 for i in range(10)] for j in range(10)]

while True:
    try:
        x, y, s = map(int, input().split(','))
    except:
        break

    if s == 1:
        area = small(x, y, area)
    if s == 2:
        area = mediam(x, y, area)
    if s == 3:
        area = large(x, y, area)

max = 0
cnt = 0

for i in range(10):
    for j in range(10):
        if area[i][j] == 0:
            cnt += 1
        if area[i][j] > max:
            max = area[i][j]
print(cnt)
print(max)
import sys

def main():
    N = int(sys.stdin.readline())
    a = list(map(int, input().split()))
    n = [0 for i in range(0, max(a)+1)]
    for i in a:
        n[i] += 1
    if len(a) < 2:
        print(sum(n))
    else:
        print(max([i+j+k for i, j, k in zip(n[:-2], n[1:-1], n[2:])]))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

def main():
    N = int(sys.stdin.readline())
    a = list(map(int, input().split()))
    n = [0 for i in range(0, max(a)+1)]
    for i in a:
        n[i] += 1
    if len(n) < 3:
        print(sum(n))
    else:
        print(max([i+j+k for i, j, k in zip(n[:-2], n[1:-1], n[2:])]))

if __name__ == '__main__':
    main()
import math
import copy
import sys
import numpy as np

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

a = getInputListInt()
min = a[0]
max = a[1]

ans_max = 2019
ans = ans_max

for i in range(min, max):
    for j in range(i+1, max+1):
        tmp = (i*j) % ans_max

        if ans > tmp:
            ans = tmp

print(ans)

### FIXED CODE ###

import math
import copy
# import numpy as np

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

a = getInputListInt()
min = a[0]
max = a[1]

ans_max = 2019
ans = ans_max

flg = False

for i in range(min, max):
    for j in range(i+1, max+1):
        tmp = (i*j) % ans_max

        if ans > tmp:
            ans = tmp

        if ans == 0:
            flg = True
            break

    if flg:
        break

print(ans)
x = raw_input()
print x**3

### FIXED CODE ###

x = int(raw_input())
print x ** 3
#ABC072-C
import collections
import itertools

n = int(input())
a = list(map(int,input().split()))
 
cnt = [0] * (n+2)


for i in a:
    cnt[i] += 1
    cnt[i+1] += 1
    cnt[i+2] += 1
    
    

    
        
print(max(cnt))


### FIXED CODE ###

#ABC072-C
n = int(input())
a = list(map(int,input().split()))
 
cnt = [0] * 100002


for i in a:
    cnt[i] += 1
    cnt[i+1] += 1
    cnt[i+2] += 1
    
    

    
        
print(max(cnt))
N=int(input())
S=str(input())
if N%2!=0:
  print('No')
elif S[0:N/2-1]==S[N/2:N-1]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N=int(input())
S=str(input())
if N%2!=0:
  print('No')
elif S[0:round(N/2)]==S[round(N/2):N]:
  print('Yes')
else:
  print('No')
k = int(input())
if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  myconst = 7 % k
  cnt = 1
  while True:
    if not myconst:
      print(cnt)
      break
	  else:
      myconst = ((10 * myconst) + 7) % k
    cnt += 1
 
      


### FIXED CODE ###

k = int(input())
if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  myconst = 7 % k
  cnt = 1
  while True:
    if not myconst:
      print(cnt)
      break
    else:
      myconst = ((10 * myconst) + 7) % k
    cnt += 1
H,W = map(int,input().split())
N = int(input())
a = map(int,input().split())

c = [0]*len(a)
n = 0
sign = 1
for h in range(H):
    state = [0]*W
    for w in range(W):
        if c[n]>=a[n]:
            n += 1
        state[w] = str(n+1)
        c[n] += 1
    sign = (sign+1)%2
    if sign:
        state = state[::-1]
    print(' '.join(state))

### FIXED CODE ###

H,W = map(int,input().split())
N = int(input())
a = list(map(int,input().split()))

c = [0]*N
n = 0
sign = 1
for h in range(H):
    state = [0]*W
    for w in range(W):
        if c[n]>=a[n]:
            n += 1
        state[w] = str(n+1)
        c[n] += 1
    sign = (sign+1)%2
    if sign:
        state = state[::-1]
    print(' '.join(state))
def d_3n_numbers(N, A):
    import heapq
    left = A[:N]
    heapq.heapify(left)
    # heappopはキューの最小値を取り出すが、rightからは最大値を取り出したいので-1を掛ける
    # 後にマイナスが付いているところは、それの帳尻を合わせている
    right = [-i for i in A[2 * N:]]
    heapq.heapify(right)

    # 最初、leftには数列の先頭N個が、rightには末尾N個が格納されている
    # 数列のN番目から2N番目まで順に、leftに格納して最小値を捨てることを繰り返す
    # 数列の2N番目からN番目まで順に、rightに格納して最大値を捨てることを繰り返す
    left_sum = [sum(left)]
    right_sum = [-sum(right)]
    for k in range(N, 2 * N):
        heapq.heappush(left, A[k])
        v = heapq.heappop(left)
        left_sum.append(left_sum[-1] + A[k] - v)
    for k in range(2 * N - 1, N - 1, -1):
        heapq.heappush(right, -A[k])
        v = heapq.heappop(right)
        right_sum.append(right_sum[-1] + A[k] - (-v))

    score = [a - b for a, b in zip(left_sum, right_sum[::-1])]
    return max(score)

N = int(input())
A = [int(i) for i in input().split()]
print(d_3N_Numbers(N, A))

### FIXED CODE ###

def d_3N_Numbers(N, A):
    import heapq
    left = A[:N]
    heapq.heapify(left)
    # heappopがキューの最小値を取り出す一方、rightからは最大値を取り出してほしいので、
    # -1を掛ける
    right = [-i for i in A[2 * N:]]
    heapq.heapify(right)
    left_sum = [sum(left)]
    right_sum = [-sum(right)]  # 定義で-1を付けた都合上

    # 同じ要素をleftとrightで取り合っても、相殺されるので問題ない
    for k in range(N, 2 * N):
        heapq.heappush(left, A[k])
        v = heapq.heappop(left)
        left_sum.append(left_sum[-1] + A[k] - v)
    for k in range(2 * N - 1, N - 1, -1):
        # -1をかけるのは、rightの定義の都合上
        heapq.heappush(right, -A[k])
        v = heapq.heappop(right)
        right_sum.append(right_sum[-1] + A[k] - (-v))
    right_sum = right_sum[::-1]
    ans = []
    for a, b in zip(left_sum, right_sum):
        ans.append(a - b)
    return max(ans)

N = int(input())
A = [int(i) for i in input().split()]
print(d_3N_Numbers(N, A))
N, M=map(int, input().split())
lst=[input().split() for _ in range(M)]
AC=[False for _ in range(N)]
WA=[0 for _ in range(N)]
for p, S in lst:
  p=int(p)-1
  if S=="AC":
    AC[p]=True
  if S=="WA" and not AC[p]:
    WA[p]+=1
for i in range(M):
  if not AC[p]:
    WA[i]=0
print(sum(AC), sum(WA))

### FIXED CODE ###

N, M=map(int, input().split())
lst=[input().split() for _ in range(M)]
AC=[False for _ in range(N)]
WA=[0 for _ in range(N)]
for p, S in lst:
  p=int(p)-1
  if S=="AC":
    AC[p]=True
  if S=="WA" and not AC[p]:
    WA[p]+=1
for i in range(N):
  if not AC[i]:
    WA[i]=0
print(sum(AC), sum(WA))
n=int(input())
lst=list(map(int,input().split()))
premin=[lst[0]]
ans=0
for x in lst:
  if min_list>=x:
    ans+=1
    premin=x
print(ans)

### FIXED CODE ###

n=int(input())
lst=list(map(int,input().split()))
premin=lst[0]
ans=0
for x in lst:
  if premin>=x:
    ans+=1
    premin=x
print(ans)
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(array[K-1])

### FIXED CODE ###

import sys

input = sys.stdin.readline
K = int(input())

array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(array[K-1])
import math

def ABC159D(a):
    if a<2:
        return 0
    else:
        return math.factorial(a)//math.factorial(a-2)//2


n=int(input())
a=list(map(int,input().split()))
d1=dict()
for i in a:
    if i not in d1:
        d1[i]=1
    else:
        d1[i] += 1
#print(d1)
d2={i:ABC159D(j) for i,j in d1.items()}
d3={i:ABC159D(j-1)-d2[i] for i,j in d1.items()}
#print(d2,d3)
p=sum(d2.values())
print(''.join([p+d3[i] for i in a]))

### FIXED CODE ###

import math

def mycounter(d,i):
    if i in d:
        d[i]+=1
    else:
        d[i]=1
    return d
    
def ABC159D(a):
    if a<2:
        return 0
    else:
        return math.factorial(a)//math.factorial(a-2)//2

n=int(input())
a=list(map(int,input().split()))
d = dict()
for i in a:
    d=mycounter(d,i)
p=sum([ABC159D(i) for i in d.values()])
for i in a:
    print(p-d[i]+1)
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
N = int(input())
F = [0]*N
H = inpl()
ans = 0
while True:
    for l in range(N):
        if F[l] < H[l]:
            for r in range(l+1, N):
                if F[r] < H[r]:
                    continue
                break
            else:
                r += 1
            if r > N:
                r = N
            for j in range(l, r):
                F[j] += 1
            if l < r:
                ans += 1
            break
    else:
        break
#assert F == H
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
N = int(input())
F = [0]*N
H = inpl()
ans = 0
while True:
    for l in range(N):
        if F[l] < H[l]:
            for r in range(l, N):
                if F[r] < H[r]:
                    continue
                break
            else:
                r += 1
            if r > N:
                r = N
            for j in range(l, r):
                F[j] += 1
            ans += 1
            break
    else:
        break
#assert F == H
print(ans)
import sys
input = sys.stdin.readline
s = input().split(,)
print(*s)

### FIXED CODE ###

import sys
input = sys.stdin.readline
s = input().rstrip().split(",")
print(*s)
from collections import Counter

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

cou = Counter(A) 

A = list(set(A))
A.sort()


C = [0]*(10**6+1)
ans = 0

for a in A:
    if C[a] == 0 and C[a] == 0:
        ans += 1

    i = 1
    while True:
        if a*i > 10**6+1:
            break
        C[a*i] = 1
        i += 1

print(ans)

### FIXED CODE ###

from collections import Counter

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

cnt = Counter(A) 

A = list(set(A))
A.sort()


C = [0]*(10**6+1)
ans = 0

for a in A:
    if C[a] == 0:
        i = 1
        while True:
            if a*i > 10**6:
                break
            C[a*i] = 1
            i += 1
        if cnt[a] == 1:
            ans += 1

print(ans)
s = input()

a = s[0]
b =len( s[1:len(s)-1])
c = s[len(s)]

print(a+b+c)


### FIXED CODE ###

s = input()

a = s[0]
b =len(s)-2
c = s[-1]

print( str(a) + str(b) + str(c))
def main():
    s = input()
    q = int(input())

    for _ in range(q):
        tmp = input()
        if len(tmp) == 1:
            s = s[::-1]
        else:
            if tmp[2] == '1':
                s = tmp[4] + s
            else:
                s = s + tmp[4]
    print(s)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import numpy as np
import math

def main():
    a, b = map(int, input().split())

    # print(a/0.08)

    a_ans = np.array([i for i in range(math.ceil(a/0.08), int((a+1)/0.08))])
    b_ans = np.array([j for j in range(math.ceil(b/0.1), int((b+1)/0.1))])

    # print(a_ans)
    # print(b_ans)
    #
    # print(a_ans * 0.08)
    # print(b_ans * 0.1)

    ans = set(a_ans) & set(b_ans)

    # print(ans)

    if ans == set():
        print(-1)
    else:
        print(min(ans))

if __name__ == '__main__':
    main()