Harryxun/stf_run huggingface dataset:
n, x = map(int, input().split())
l = [int(i) for i in input().split()]

i = 0
while True:
    if x - l[i] < 0:
        break
    x -= l[i]
    i += 1

print(i+1)


### FIXED CODE ###

n, x = map(int, input().split())
l = [int(i) for i in input().split()]

i = 0
for i in range(n):
    if x - l[i] < 0:
        break
    x -= l[i]
    i += 1

print(i+1)
number = input()
print(number **3)

### FIXED CODE ###

num = int(input())
number = num **3
print(number)
import heapq
import numpy as np

t = int(input())

for _ in range(t):
    n, a, b, c, d = map(int, input().split())
    # x to lowest coin
    cheapest = dict()
    # (coin, x)
    search = [(d, 1)]
    first = True

    while 1:
        coin, x = heapq.heappop(search)

        if (x > 1 or first) and x not in cheapest:
            first = False
            if x == n:
                print(coin)
                break
            cheapest[x] = coin

            heapq.heappush(search, (coin + a, 2 * x))
            heapq.heappush(search, (coin + b, 3 * x))
            heapq.heappush(search, (coin + c, 5 * x))
            heapq.heappush(search, (coin + d, x + 1))
            if x - 1 > 1:
                heapq.heappush(search, (coin + d, x - 1))

### FIXED CODE ###

t = int(input())

import sys
sys.setrecursionlimit(10 ** 6)

def calc(x):
    if x in dp:
        return dp[x]
    
    divs = [5, 3, 2]
    costs = [c, b, a]
    res = d * x
    for div, cost in zip(divs, costs):
        dived = x//div
        res = min(res, calc(dived) + cost + abs(x-dived*div) * d)
        if x > div:
            dived = x//div+1
            res = min(res, calc(dived) + cost + abs(x-dived*div) * d)
    dp[x] = res
    return res

for _ in range(t):
    n, a, b, c, d = list(map(int, input().split()))
    dp = {}
    dp[0] = 0
    dp[1] = d
    print(calc(n))
N=int(input())
S=[]
count++
for i in range(N):
    A=input()
    if A not in S:
        S.append(A)
        count+=1
print(count)

### FIXED CODE ###

N=int(input())
S=[]
for i in range(N):
    A=input()
    S.append(A)
print(len(set(S)))
import sys

X, N = map(int, input().split())
P = list(map(int, input().split()))

l = [ i for i in range(1,101) ]

if len(P) == 0:
    print(X)
    sys.exit()

idx = l.index(X)

ans = 0
for i in range(1,100):
    if l[idx+i] not in P:
        ans = i
        break

ans1 = 0
for i in range(1,100):
    if l[idx-i] not in P:
        ans1 = i
        break

if ans<ans1:
    print(l[idx+ans])
else:
    print(l[idx-ans1])



### FIXED CODE ###

import sys

X, N = map(int, input().split())
P = list(map(int, input().split()))
NL = [ i for i in range(0, 102) if i == X or i not in P ]

if len(P) == 0 or X not in P:
    print(X)
    sys.exit()

idx = NL.index(X)
if NL[idx + 1] - X >= X - NL[idx-1]:
    print(NL[idx-1])
else:
    print(NL[idx+1])
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    h,n=map(int,input().split())
    lis=np.array([list(map(int,input().split())) for _ in range(n)])
    dp=np.zeros(h+1,int)
    dp[0]=0
    for l in lis:
        dp[1:l[0]+1]=np.minimum(dp[1:l[0]+1],l[1])
    for i in range(1,h+1):
        dp[i]=np.min(dp[i-lis[:,0]]+lis[:,1])
    print(dp[h])

if __name__=='__main__':
    main()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    h,n=map(int,input().split())
    lis=np.array([list(map(int,input().split())) for _ in range(n)])
    dp=np.zeros(10**4+1,int)
    dp[0]=0
    for l in lis:
        dp[1:l[0]+1]=np.minimum(dp[1:l[0]+1],l[1])
    for i in range(1,h+1):
        dp[i]=np.min(dp[i-lis[:,0]]+lis[:,1])
    print(dp[h])

if __name__=='__main__':
    main()
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *H = map(int, read().split())
    
    ans = []
    c = 0
    for i in range(N-1):
        if H[i] >= H[i+1]:
            c += 1
        else:
            ans.append(c)
            c = 0
            
    if c > 0:
        ans.append(c)
            
    print(max(ans))
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *H = map(int, read().split())

    ans = []
    c = 0
    for i in range(N - 1):
        if H[i] >= H[i + 1]:
            c += 1
        else:
            ans.append(c)
            c = 0

    ans.append(c)

    print(max(ans))
    return


if __name__ == '__main__':
    main()
import sys
input = sys.stdin.readline
INF = 10**18
sys.setrecursionlimit(10**6)
import itertools as it
import collections as cl
from collections import deque
import math
from functools import reduce
from collections import defaultdict


def li():
    return [int(x) for x in input().split()]


N, X, MOD = li()


n = X
seen = [False] * (10 ** 5)
sums = [X]
zero = False
for i in range(1, N):
    n = pow(n, 2, MOD)
    if n==0:
        zero = True
        break
    if seen[n]:
        break
    seen[n] = True
    # print(n)
    sums.append(n)
# total %= MOD
loop_cnt = N // (i-1) + 1
amari = N % (i-1)
print(amari)
ans = 0
if zero:
    ans = sum(sums)
else:
    ans = (sum(sums) * loop_cnt + sum(sums[:amari]))
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
INF = 10**18
sys.setrecursionlimit(10**6)


def li():
    return [int(x) for x in input().split()]


N, X, MOD = li()


n = X
nums = [X]
loop_start_i = -INF
for i in range(1, N):
    n = pow(n, 2, MOD)
    if n in nums:
        loop_start_i = nums.index(n)
        break
    nums.append(n)
# total %= MOD
loop_length = len(nums) - loop_start_i
loop_cnt = (N - loop_start_i) // loop_length
r = (N - loop_start_i) % loop_length
sum_per_loop = sum(nums[loop_start_i:])
ans = sum(nums[:loop_start_i]) + sum_per_loop * loop_cnt + sum(nums[loop_start_i:loop_start_i+r])
print(ans)
N = int(input())
in = list(map(int, input.split()))

P = round(sum(in)/N)

sum = 0
for i in range(N):
  sum += (in[i] - P)**2
  
print(sum)

### FIXED CODE ###

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

P = round(sum(numbers)/N)

sum = 0
for i in range(N):
  sum += (numbers[i] - P)**2

print(sum)
a,b,c = map(int,input().split())

s = set(["a","b","c"])

if len(s) = 2:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

s = set([a,b,c])

if len(s) == 2:
  print("Yes")
else:
  print("No")
n=int(input())
if n%2=0:
  print((n/2)-1)
else:
  print((n-1)/2)


### FIXED CODE ###

n=int(input())
if n%2==0:
  print(int((n/2)-1))
else:
  print(int((n-1)/2))
N = int(input())  # 頂点数
C = [int(x) - 1  for x in input().split()]  # 頂点の色番号 (1~N) -> (0~N-1)

E = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)

# 区間データを保管するテーブル
class BIT():
    def __init__(self, n):
        self.size = n
        self.data = [0] * (n+1)  # 今回は1で初期化する。 BIT の先頭は 1からなのでずらす
        
    def add(self, i, s):  # i の情報を更新する
        while i <= self.size:
            self.data[i] += s
            i += i & -i
    
    def sum(self, i):  # 1～i 番目までの合計
        tmp = 0
        while i > 0:
            tmp += self.data[i]
            i -= i & -i
        return tmp

def dfs(u, p = -1):

    global k, I, O
    
    us = 1
    I[u] = k
    k += 1
    
    for v in E[u]:
        if not v == p:
            us += dfs(v, u)
    O[u] = k

    return us

# 経路の組み合わせ数を計算する
def comb2(n):
    return n*(n+1)//2

k = 1
I = [0] * N  # 走査に入ったタイミング
O = [0] * N  # 上に戻ったタイミング
dfs(0)

# 色番号ごとに、頂点をまとめる。まとめらたら、子要素から操作するように並べ替える
VC = [ [] for _ in range(N)]
for j in range(N):
    VC[C[j]].append(j)

for j in range(N):
    VC[j].sort(key=lambda x:I[x], reverse=True)


total = comb2(N)

bit = BIT(N)
for i in range(N):
    bit.add(i+1, 1)

for j in range(N):
        
    ans = total
    history = []
    for u in VC[j]:
        cnt = 1
        for v in E[u]:
            if I[u] > I[v]:
                continue
            num = bit.sum(O[v]-1) - bit.sum(I[v]-1)
            ans -= comb2(num)
            cnt += num
        bit.add(I[u], -cnt)
        history.append((I[u], cnt))
    ans -= comb2(bit.sum(N))
    for a, b in history:
        bit.add(a,b)
    print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
 
N = int(input())  # 頂点数
C = [int(x) - 1  for x in input().split()]  # 頂点の色番号 (1~N) -> (0~N-1)
 
E = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
    
def dfs(u, p = -1):
 
    color = C[u]  # 色番号
    VC[color].append(u)  # 色ごとに stack しておく
    
    s = 1  # 部分木サイズ（を格納する）
    for v in E[u]:
        if v == p:
            continue
            
        child[u] = 0  # v の方向にある子孫のうち辿れる頂点の数 = s - 子孫にある、同色を根とする部分木のサイズの合計
        ret = dfs(v, u)
 
        s += ret  # 純粋な部分木のサイズを計算
        child[u] += ret  # 同色の頂点が切り離されたあとの部分木サイズ
        
        ans[color] -= child[u] * (child[u] + 1) // 2        
 
    VC[color].pop()
    if VC[color]: # 上位に同じ色がある場合
        child[VC[color][-1]] -= s  # 一番近い同色から、自分の部分木の大きさをひく
    else:  # 上位に同じ色がない場合
        root_size[color] -= s  # 上位に残っている頂点の数
        
    return s

child = [0] * N  # 辿っている子の中でのの残り数　とりあえず 0で初期化
root_size = [N] * N  # 根方向に残っている頂点の数（を格納する。操作前は N 全部）
VC = [ [] for _ in range(N)]  # 色番号ごと
ans = [N*(N+1)//2] * N  # 色ごとの（残りの）組み合わせ数　初期値は 全点の組み合わせ
 
dfs(0)
 
for i in range(N):
    print(ans[i] - root_size[i] * (root_size[i] + 1) // 2)
s = input()
s1 = s[:1]
for i in range(1, 4):
  if(s[i:i+1] != s1):
    s[i:i+1] = s2
if(s.count(s1) == 2 and s.count(s2) == 2):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = input()
s1 = s[:1]
for i in range(1, 4):
  if(s[i:i+1] != s1):
    s2 = s[i:i+1]
if(s.count(s1) == 2 and s.count(s2) == 2):
  print("Yes")
else:
  print("No")
N=int(input())
A=list(map(int,input().split()))
n=0
i=0
while(n<N):
    i+=1
    n=2**i
INF=0
dat=[INF]*(2*n-1)
def update(i,x):
    i+=n-1
    dat[i]=x
    while(i>0):
        i=(i-1)//2
        dat[i]=gcd(dat[i*2+1],dat[i*2+2])
def find(a,b,k,l,r):
    if r<=a or b<=l:
        return INF
    if a<=l and r<=b:
        return dat[k]
    else:
        vl=find(a,b,k*2+1,l,(l+r)//2)
        vr=find(a,b,k*2+2,(l+r)//2,r)
        return gcd(vl,vr)
for i in range(N):
    update(i,A[i])
ans=0
for i in range(N):
    f=find(0,i,0,0,n)
    g=find(i+1,N,0,0,n)
    ans=max(gcd(f,g),ans)
print(ans)


### FIXED CODE ###

from fractions import gcd

N=int(input())
A=list(map(int,input().split()))
X=[A[0]]
Y=[A[-1]]
for i in range(N):
    X.append(gcd(X[-1],A[i]))
    Y.append(gcd(Y[-1],A[N-1-i]))
X=X[1:]
Y=Y[1:]
Y=Y[::-1]
ans=1
for i in range(N):
    if i==0:
        ans_=Y[i+1]
    elif i==N-1:
        ans_=X[i-1]
    else:
        ans_=gcd(X[i-1],Y[i+1])
    ans=max(ans,ans_)
print(ans)
a, b = map(int, input().split())
if ((a+b)%2) == 1:
    print (IMPOSSIBLE )
else:
    print ((a+b)/2)

### FIXED CODE ###

a, b = map(int, input().split())
if ((a+b)%2) == 1:
    print ('IMPOSSIBLE')
else:
    print ((a+b)//2)
print(len([1 for i in [104,134,164,188,194] if i<int(input())]))

### FIXED CODE ###

s=[]
for i in range(201)[105::2]:
  d=1;k=i
  for h in range(2,i+1):
    if i%h==0:
      cnt=0
      while i%h==0:
        cnt+=1
        i//=h
      d*=(cnt+1)
  if d==8:
    s.append(k)
ans=0;n=int(input())
for f in s:
  if n>=f:ans+=1
print(ans)
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

A, B = mapint()
print(mas(A+B, A-B, A*B))

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

A, B = mapint()
print(max(A+B, A-B, A*B))
import math
 
a = list(map(int,input().split()))
 
c = reduce((lambda x,y: (x+y)/2 ,a)
 
print(math.ceil(c))



### FIXED CODE ###

import math
a,b = map(int,input().split())
print(math.ceil((a+b)/2))
N,M = [int(i) for i in input().split()]
d = {}
for i in range(M):
    s,c = [int(i) for i in input().split()]
    if d.get(s,c) != c:
        print(-1)
        break
    else:
        d[s] = c
else:
    if d[1] == 0:
        print(-1)
    else:
        l=[str(d.get(1,1))]
        l=[str(d.get(i,0)) for i in range(2, N+1)]
        print(''.join(l))


### FIXED CODE ###

N,M = [int(i) for i in input().split()]
d = {}
for i in range(M):
    s,c = [int(i) for i in input().split()]
    if d.get(s,c) != c:
        print(-1)
        break
    else:
        d[s] = c
else:
    if N==1:
        print(d.get(1,0))
    elif d.get(1,1) == 0:
        print(-1)
    else:
        l = [str(d.get(1,1))]
        l+=[str(d.get(i,0)) for i in range(2, N+1)]
        print(''.join(l))
import math
N = int(inpit())
print math.pi*N


### FIXED CODE ###

import math
n = int(input())
print(2*math.pi*n)
'''
    Auther: ghoshashis545 Ashis Ghosh
    college: jalpaiguri Govt Enggineering College
    Date:06/03/2020
'''
from math import ceil,sqrt,gcd,log,floor
from collections import deque
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().strip().split(" "))
def li(): return list(mi())
def msi(): return map(str,input().strip().split(" "))
def lsi(): return list(msi())
#for _ in range(ii()):
n=ii()
print(ceil(n/2))

### FIXED CODE ###

n=int(input())
print(n//2+n%2)
N,R = map(int, input().split())

if N < 10:
    print(R)
else:
    print(100*(10-K))

### FIXED CODE ###

N,R = map(int, input().split())

if N >= 10:
    print(R)
else:
    print((100*(10-N))+R)
c=input()
if c==a or c==i or c==u or c==e or c==o:
    print('vowel')
else:
    print('consonant')

### FIXED CODE ###

c=input()
if c=='a' or c=='i' or c=='u' or c=='e' or c=='o':
    print('vowel')
else:
    print('consonant')
A,B,K = map(int(),input().rstrip().split())

for i in range(K):
  if i % 2 == 0:
    B = B + A/2
    A = A/2
   else:
    A = A + B/2
    B=B/2

print (A,B)

### FIXED CODE ###

A, B, K = map(int, input().split())
for i in range(0, K):
    if(i & 1):
        if(B & 1):
            B -= 1
        A += B//2
        B //= 2
    else:
        if(A & 1):
            A -= 1
        B += A//2
        A //= 2
print("{0} {1}".format(A, B))
import sys
input = sys.stdin.readline

n = int(input())
s = list(input())
res = 10**6
ctw = 0
ctb = 0
w = [0]*n
b = [0]*n

for i in range(n):
     if s[i] == ".":
          ctw += 1
     else:
          ctb += 1
     w[i]= ctw
     b[i]= ctb
for i in range(n):
     res = min(res,b[i]+w[-1]-w[i])
res = min(res,[-1],b[-1])
print(res)
      

### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
s = list(input())
res = 10**9

cta = 0
ctb = 0
a = [0]*n
b = [0]*n
for i in range(n):
    if s[i] == '.':
        cta += 1
    else:
        ctb += 1
    a[i] = cta
    b[i] = ctb
for i in range(n):
    res = min(res,b[i]+a[-1]-a[i])
res = min(res,a[-1],b[-1])
print(res)
import math

s=list(input().split('T'))
sn=[]

for i in range(len(s)):
    sn.append(len(s[i]))

x, y = map(int,input().split(' '))
x = x-sn[0]

snx=[]
sny=[]

for i in range(2,len(sn),2):
    snx.append(sn[i])

for i in range(1,len(sn),2):
    sny.append(sn[i])

#X軸判定
xflg = 0
ansx=[]
prex=[0]
for i in range(len(snx)):
    tmpx=set()
    for j in prex:
        tmpx.add(j+snx[i])
        tmpx.add(j-snx[i])
    prex=tmpx

if x in tmpx:
    xflg = 1

#y軸判定
yflg = 0
prey=[0]
for i in range(len(sny)):
    tmpy=set()
    for j in tmpy:
        tmpy.add(j+sny[i])
        tmpy.add(j-sny[i])
    prey=tmpy

if y in tmpy:
    yflg = 1

if xflg == 1 and yflg == 1:
    print("Yes")
else:
    print("No")



### FIXED CODE ###

import math

s=list(input().split('T'))
sn=[]

for i in range(len(s)):
    sn.append(len(s[i]))

x, y = map(int,input().split(' '))
x = x-sn[0]

snx=[]
sny=[]

for i in range(2,len(sn),2):
    snx.append(sn[i])

for i in range(1,len(sn),2):
    sny.append(sn[i])

#X軸判定
xflg = 0
ansx=[]
prex=[0]
tmpx=[0]
for i in range(len(snx)):
    tmpx=set()
    for j in prex:
        tmpx.add(j+snx[i])
        tmpx.add(j-snx[i])
    prex=tmpx

if x in tmpx:
    xflg = 1

#y軸判定
yflg = 0
prey=[0]
tmpy=[0]
for i in range(len(sny)):
    tmpy=set()
    for j in prey:
        tmpy.add(j+sny[i])
        tmpy.add(j-sny[i])
    prey=tmpy

if y in tmpy:
    yflg = 1

if xflg == 1 and yflg == 1:
    print("Yes")
else:
    print("No")
H, A=map(int, input().split)
if H % A == 0:
  print(H / A)
else:
  print(H // A + 1)

### FIXED CODE ###

H, A=map(int, input().split())
if H % A == 0:
  print(H // A)
else:
  print(H // A + 1)
s=set(input())
a='abcdefghijklmnopqrstuvwxyz'
b=set()
for i in range(26):
    b.append(a[i])
if s==b:
    print('None')
else:
    print(b-s)


### FIXED CODE ###

s=set(list(input()))
a=set(list('abcdefghijklmnopqrstuvwxyz'))

if s==a:
    print('None')
else:
    b=sorted(list(a-s))
    print(str(b[0]))
N = int(input())
# h,n,w
temp = int((3*N)/4)
hlist = [i+1 for i in range(temp)]
flag = False
for i in hlist:
    temp = 4/N - 1/i
    nlist = [i+1 for i in range(int(2/temp))]
    for j in nlist:
        beta = 4/N - 1/i - 1/j
        if (beta > 0):
            if(1/beta == int(1/beta)):
                w = int(1/beta)
                n = j
                h = i
                flag = True
                break

    if flag:
        break

print(str(h)+ " " + str(n)+ " " +str(w))

### FIXED CODE ###

N = int(input())
flag = False
for i in range(1,3500):
    for j in range(1,3500):
        if((4*i*j - N*i - N*j) > 0 and (N*i*j)%(4*i*j - N*i - N*j) == 0):
            w = int((N*i*j)/(4*i*j - N*i - N*j))
            h = i
            n = j
            flag = True
            break
    if flag:
        break

print(h,n,w)
from collections import Counter

mod = 10**9+7
rng = 100001
fctr = [1]
finv = [1]
for i in range(1,rng):
  fctr.append(fctr[-1]*i%mod)
for i in range(1,rng):
  finv.append(pow(fctr[i],mod-2,mod))
def cmb(n,k):
  if n<=0 or k<0 or n<k:
    return 0
  else:
    return fctr[n]*finv[n-k]*finv[k]%mod

n = int(input())
a = list(map(int,input().split()))
same = []
c = Counter(a)
x = c.most_common()[0][0]
for i in range(n+1):
  if a[i] == x:
    same.append(i+1)
y = same[1]-same[0]+1
print(n)
for k in range(2,n+2):
  print((cmb(n+1,k)-cmb(n+1-y,k-1))%mod)

### FIXED CODE ###

from collections import Counter

mod = 10**9+7
rng = 100002
fctr = [1]
finv = [1]
for i in range(1,rng):
  fctr.append(fctr[-1]*i%mod)
for i in range(1,rng):
  finv.append(pow(fctr[i],mod-2,mod))
def cmb(n,k):
  if n<=0 or k<0 or n<k:
    return 0
  else:
    return fctr[n]*finv[n-k]*finv[k]%mod

n = int(input())
a = list(map(int,input().split()))
same = []
c = Counter(a)
x = c.most_common()[0][0]
for i in range(n+1):
  if a[i] == x:
    same.append(i+1)
y = same[1]-same[0]+1
print(n)
for k in range(2,n+2):
  print((cmb(n+1,k)-cmb(n+1-y,k-1))%mod)
N, M, K = [int(x) for x in input().strip().split()]
A = [int(x) for x in input().strip().split()]
B = [int(x) for x in input().strip().split()]
i = j = 0
ct = 0
while k> 0: 
  if A[i] < B[j] and k-A[i] > 0: 
    k -= A[i]
    i +=1
    ct +=1
  elif k-B[j] > 0: 
    k -= B[j]
    j +=1
  	ct += 1
print(ct)

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
a, b = [0], [0]
for i in range(N):
	a.append(a[i]+A[i])
for i in range(M):
	b.append(b[i]+B[i])
	
ans, j = 0, M
for i in range(N+1):
	if a[i] > K:
		break
	while b[j] > K - a[i]:
		j -= 1
	ans = max(ans, i+j)
	
print(ans)
input()
aa = list(map(int, input().split()))
uu = list(set(aa))
cc = uu.copy()
for i in range(len(uu)):
    cc[i] = aa.count(uu[i])
    total += cc[i] * (cc[i]-1) / 2

dic = dict(zip(uu,cc))

for a in aa:
    print(int(total - dic[a] + 1))

### FIXED CODE ###

input()
from collections import Counter
aa = list(map(int, input().split()))
dic = Counter(aa)

total = 0
for v in dic.values():
    total += v * (v-1) / 2

for a in aa:
    print(int(total - dic[a] + 1))
# -*- coding: utf-8 -*-
import copy
from operator import itemgetter

[N, M] = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
BC = []
for m in range(M):
    BC.append([int(i) for i in input().split()])

# Aをソートする
A.sort()

# BCをCが大きい順にソートする
sorted_BC = sorted(BC, key=itemgetter(1, 0), reverse=True)
#sorted_BC = sorted(BC, key=lambda x:(x[1]), reverse=True)

new_BC = []
now_B = 0
now_C = -1
for [B, C] in sorted_BC:
    if now_C == -1:
        now_C = C

    if C == now_C:
        now_B += B
    else:
        new_BC.append([now_B, now_C])
        now_B = B
        now_C = C

if now_C != -1:
    new_BC.append([now_B, now_C])

for [B, C] in new_BC:
    # もしAの最小値がCを超えていたらもうやる意味ないので終了
    if A[0] > C:
        break

    # 小さいほうからB枚のカードをCに変える
    # ただし変えるのは元の数字より大きい時だけ
    for i in range(B):
        if A[i] < C:
            A[i] = C
    A.sort()


print (sum(A))


### FIXED CODE ###

# -*- coding: utf-8 -*-
import copy
from operator import itemgetter

[N, M] = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
BC = []
for m in range(M):
    BC.append([int(i) for i in input().split()])

# Aをソートする
A.sort()

# BCをCが大きい順にソートする
sorted_BC = sorted(BC, key=itemgetter(1, 0), reverse=True)

new_A = []
for [B, C] in sorted_BC:
    # もしAの最小値がCを超えていたらもうやる意味ないので終了
    if A[0] > C:
        break

    # 小さいほうからB枚のカードをCに変える
    # ただし変えるのは元の数字より大きい時だけ
    I = 0
    for i in range(B):
        I = i
        if len(A) <= i:
            I -=1
            break
        if A[i] > C:
            I -=1
            break
        new_A.append(C)
        #print(new_A)

    # 変えた分はリストから除外する
    #print(A)
    #print(I)
    del A[:I+1]
    if len(A) == 0:
        break

    #print(A)

if len(A) != 0:
    new_A.extend(A)

print (sum(new_A))
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]

a = sorted(l, key=lambda x:x[0])
b = sorted(l, key=lambda x:x[1])

if n % 2 == 1:
  print(b[n//2] - a[n//2] +1)
else:
  print((b[n//2][1] - a[n//2-1][0]+1)*(b[n//2][1] - a[n//2-1][0])//2)

### FIXED CODE ###

n = int(input())
l = [list(map(int, input().split())) for i in range(n)]

a = sorted(l, key=lambda x:x[0])
b = sorted(l, key=lambda x:x[1])

if n % 2 == 1:
  print(b[n//2][1] - a[n//2][0] +1)
else:
  print((b[n//2][1]+b[n//2-1][1])-(a[n//2][0]+a[n//2-1][0])+1)
N, M = map(int, input().split())
a_k = [list(map(int, input().split())) for i in range(N)]
a_k.sort()

for i in range(1, len(a_k)):
    a_non = []

    for j in range(1, len(a_k[0])):
        if a_k[0][j] not in a_k[i][1:]:
            a_non.append(j)

    for j in range(len(a_non)):
        a_k[0].pop(a_non[j])
    if len(a_k[0]) <= 1:
        break


print(len(a_k[0]) - 1)


### FIXED CODE ###

N, M = map(int, input().split())
k = [i[1:] for i in [list(map(int, input().split())) for i in range(N)]]
k_1 = [flatten for inner in k for flatten in inner]
count_k = 0
for i in range(1, M + 1):
    if k_1.count(i) == N:
        count_k += 1

print(count_k)
a,b=int(input().split())
if a < 10:
  print(b)
else:
  print(b-1000+100*a)


### FIXED CODE ###

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

if a >=10:
  c=int(b)
  print(c)
else:
  c=int(b+1000-100*a)
  print(c)
A, B = map(int, input().split())
print(max(2*A-1, 2*B-1, A+B)

### FIXED CODE ###

A, B = map(int, input().split())
print(int(max(2*A-1, 2*B-1, A+B)))