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

# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 998244353
N, A, B, K = lr()
answer = 0
# A * x + B * y = K
# nCx * nCy

def perm(n,k):
    if k > n or k < 0: return 0
    return fact[n] * fact_inv[n-k] % MOD

def cmb(n, k):
    if k < 0 or k > n: return 0 
    return fact[n] * fact_inv[k] % MOD * fact_inv[n-k] % MOD

def cumprod(arr, MOD):
    L = len(arr); Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]; arr[n] %= MOD
    return arr.ravel()[:L]

def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64); x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv

U = 10 ** 6 # 階乗テーブルの上限
fact, fact_inv = make_fact(U, MOD)

for x in range(K//A+1):
    temp = K-A*x
    if temp%B != 0:
        continue
    y = temp // B
    if y > N:
        continue
    if y < 0:
        break
    answer += cmb(N, x) * cmb(N, y)
    answer %= MOD

print(answer % MOD)


### FIXED CODE ###

# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 998244353
N, A, B, K = lr()
answer = 0
# A * x + B * y = K
# nCx * nCy

def cmb(n, k):
    if k < 0 or k > n: return 0 
    return fact_N * fact_inv[k] % MOD * fact_inv[n-k] % MOD

def cumprod(arr, MOD):
    L = len(arr); Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]; arr[n] %= MOD
    return arr.ravel()[:L]

def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64); x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv

U = N + 100 # 階乗テーブルの上限
fact, fact_inv = make_fact(U, MOD)
fact_N = fact[N]

for x in range(N+1):
    temp = K-A*x
    if temp%B != 0:
        continue
    y = temp // B
    if y > N:
        continue
    if y < 0:
        break
    answer += cmb(N, x) * cmb(N, y)
    answer %= MOD

print(answer % MOD)
### BUGGY CODE ###

# encoding="UTF-8"

N = int(input())
S = []
for i in range(N):
    temp=input()
    if (temp in S) == False:
        S.append(temp)
print(len(S))

### FIXED CODE ###

# encoding="UTF-8"

N = int(input())
S = set()
for i in range(N):
    S.add(input())

print(len(S))
### BUGGY CODE ###

a,b,n=map(int,input().split())
s=n//b
nmax = (a*n)//b - a*(n//b)
for i in range(1,s+1):
    x = b*i-1
    t = (a*x)//b - a*(x//b)
    if t > nmax:
        nmax = t
print(nmax)

### FIXED CODE ###

a,b,n=map(int,input().split())
s=n//b
nmax = (a*n)//b - a*(n//b)
# b_n = b
# b_nn = 0
# while b_n <= n:
#     x = b_n -1
#     t = (a*x)//b - a*b_nn
#     if t > nmax:
#         nmax = t
#     b_n += b
#     b_nn +=1
if s>0:
    x = b*s-1
    t = (a*x)//b - a*(s-1)
    if t > nmax:
        nmax = t
print(nmax)
### BUGGY CODE ###

#その前のstrと違って、けど一番短いのを足していけばいいだけ。
S = input()
L = [alphabet for alphabet in S]
moji1 = L[0]
moji2 = ''
i = 1
res = 0
while i < len(L):
  if moji1 == moji2:
    moji2 += L[i]
    i+=1
  elif moji1 != moji2 and moji2 != '':
    res += 1
    moji1 = moji2
    moji2 = L[i]
    i += 1
print(res)

### FIXED CODE ###

#その前のstrと違って、けど一番短いのを足していけばいいだけ。
S = input()
L = [alphabet for alphabet in S]
i = 0
k = 1
before = ''
res = 0
while i+k <= len(L):
  if L[i:i+k] != before:
    res += 1
    before = L[i:i+k] # "before" updated
    i = i+k #next a of L[a:b]
    k = 1 #initialised
  else:
    k += 1
print(res)
### BUGGY CODE ###

n, k  = map(int,input().split())
p = list(map(int,input().split()))
s = 0
for i in range(n-k+1):
  s = max(s,sum(p[i:(k+i)]))
print((s+k)/2)

### FIXED CODE ###

n, k  = map(int,input().split())
p = list(map(int,input().split()))
t = sum(p[0:k])
s = t
for i in range(1,n-k+1):
  t = t - p[i-1] + p[i+k-1]
  s = max(s,t)
print((s+k)/2)
### BUGGY CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
 
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
 
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
 
 
def main():
    n,k = LI()
    a = sorted(LI(), key=lambda x: -x)
    s = [set() for _ in range(k)]
    rs = set()
    for i in range(n):
        ai = a[i]
        if ai >= k:
            rs.add(i)
            continue
        for j in range(k-1,0,-1):
            sj = s[j]
            if sj:
                if j+ai < k:
                    s[j+ai] |= sj
                    s[j+ai].add(i)
                else:
                    rs |= sj
                    rs.add(i)
        s[ai].add(i)
 
    return n-len(rs)
 
 
print(main())

### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    n,k = LI()
    a = sorted(LI())
    sa = sum(a)
    if sa < k:
        return n
    if sa - a[0] < k:
        return 0

    mi = 0
    ma = n-1

    def f(m):
        am = a[m]
        if am >= k:
            return True

        t = [False] * (k-am)
        t[0] = True
        tl = len(t)
        for i in range(n):
            if i==m:
                continue
            ai = a[i]
            for j in range(tl-1,-1,-1):
                if not t[j]:
                    continue
                if k <= j+ai:
                    continue
                if j+ai >= tl:
                    return True

                t[j+ai] = True

        return False

    while mi < ma:
        m = (mi+ma) // 2
        if f(m):
            ma = m
        else:
            mi = m+1

    return mi


print(main())
### BUGGY CODE ###

def main():
    import sys
    from itertools import accumulate

    n = int(input())
    a = list(map(int, sys.stdin.readline().split()))
    b = list(accumulate(a))

    ans = 0
    for i, x in enumerate(b):
        if x == 0: ans += 1
        for y in b[:i]:
            if x - y == 0:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import sys
    from itertools import accumulate
    from collections import Counter

    n = int(input())
    a = list(map(int, sys.stdin.readline().split()))
    b = [0] + list(accumulate(a))
    c = Counter(b)

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

    print(ans)


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

import sys
sys.setrecursionlimit(400000000)
n,k=map(int,input().split())
h=list(map(int,input().split()))
flog=[-1]*n
#初期値は0
def Num(dest):
    if flog[dest-1]!=-1:
        return flog[dest-1]
    if dest<k+2:
        res=abs(h[dest-1]-h[0])
        flog[dest-1]=res
        return res
    else:
        min=10**10
        for i in range(1,k+1):
            tmp=Num(dest-i)+abs(h[dest-1]-h[dest-i-1])
            if min>tmp:
                min=tmp
        flog[dest-1]=min
        return min   
print(Num(n))

### FIXED CODE ###

import sys
sys.setrecursionlimit(400000000)
def main():
    n,k=map(int,input().split())
    h=tuple(map(int,input().split()))
    flog=[-1]*n
    for i in range(n):#dest=i 0が１
        if i<k+1:#0~k
            flog[i]=abs(h[i]-h[0])
        else:
            min=10**9
            for j in range(1,k+1):#1~k
                tmp=flog[i-j]+abs(h[i]-h[i-j])
                if tmp<min:
                    min=tmp
            flog[i]=min
    print(flog[n-1])
   # print(flog)
if __name__=="__main__":
    main()
### BUGGY CODE ###

import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    a = kwargs["a"]
    b = kwargs["b"]
    n = kwargs["n"]
    res = 0

    for i in range(min(b, n) + 1):
        res = max(res, a * i // b - a * (i // b))

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    kwargs["a"], kwargs["b"], kwargs["n"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

### FIXED CODE ###

import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    a = kwargs["a"]
    b = kwargs["b"]
    n = kwargs["n"]

    for i in range(min(b, n), -1, -1):
        res = a * i // b - a * (i // b)

        if res > 0:
            break

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    kwargs["a"], kwargs["b"], kwargs["n"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)
### BUGGY CODE ###

S = input()
con = 10**9 + 7

T = [s if s != "?" else "0" for s in S]
T = int(''.join(T))
SS = T % 13

c = {}
iii = 1
for i in range(len(S)):
    if S[len(S) - i - 1] != "?":
        iii *= 10
        iii %= 13
        continue
    tc = {}
    for j in range(0, 10):
        t = (j * iii) % 13
        tc[t] = 1
    c[i] = tc
    iii *= 10
    iii %= 13

dp = []
tdp = {i: 0 for i in range(13)}
tdp[SS] += 1
dp.append(tdp)
for k, v in c.items():
    tdp = {i: 0 for i in range(13)}
    for r, _ in v.items():
        for _r, _v in dp[-1].items():
            tdp[(_r + r) % 13] += _v
            tdp[(_r + r) % 13] %= con
    dp.append(tdp)

ans = dp[-1][5]
print(ans)

### FIXED CODE ###

S = input()
con = 10**9 + 7

T = [s if s != "?" else "0" for s in S]
T = int(''.join(T))
SS = T % 13

def get_mod(S):
    c = {}
    iii = 1
    for i in range(len(S)):
        if S[len(S) - i - 1] != "?":
            iii *= 10
            iii %= 13
            continue
        c[i] = {(j * iii) % 13: 1 for j in range(0, 10)}
        iii *= 10
        iii %= 13
    return c
c = get_mod(S)

def get_tdp(pdp):
    tdp = {i: 0 for i in range(13)}
    for r in v.keys():
        for _r, _v in pdp.items():
            tdp[(_r + r) % 13] += _v
    for i in range(13):
        tdp[i] %= con
    return tdp

pdp = {i: 0 for i in range(13)}
pdp[SS] += 1
for k, v in c.items():
    pdp = get_tdp(pdp)

ans = pdp[5]
print(ans)
### BUGGY CODE ###

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

count = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                count += 1
print(count)

### FIXED CODE ###

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

count = 0
for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if z >= 0 and z <= K:
            count += 1
print(count)
### BUGGY CODE ###

H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
A = [[[0,0] for _ in range(W)] for _ in range(H)]
for i in range(H):
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            cnt = 0
        else:
            cnt += 1
            A[i][j][0] = cnt
for i in range(H):
    for j in range(W-1,-1,-1):
        if S[i][j]=="." and j+1<W:
            A[i][j][0] = max(A[i][j][0],A[i][j+1][0])
for j in range(W):
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            cnt = 0
        else:
            cnt += 1
            A[i][j][1] = cnt
cmax = 0
for j in range(W):
    for i in range(H-1,-1,-1):
        if S[i][j]=="." and i+1<H:
            A[i][j][1] = max(A[i][j][1],A[i+1][j][1])
        cmax = max(cmax,A[i][j][0]+A[i][j][1]-1)
print(cmax)        

### FIXED CODE ###

H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)
### BUGGY CODE ###

def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p

def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p

N, A, B, K = map(int, input().split())
Q = 998244353
ans = 0
for i in range(N+1):
    if (K - A*i)%B == 0 and (K - A*i)/B <= N:
        j = (K - A*i)/B
        ans = (ans + comb(N,i,Q)*comb(N,j,Q))%Q
print(ans)

### FIXED CODE ###

Q = 998244353
def getInv(N):
    inv = [0] * (N + 1)
    inv[0] = 1
    inv[1] = 1
    for i in range(2, N + 1):
        inv[i] = (-(Q // i) * inv[Q%i]) % Q
    return inv

N, A, B, K = map( int, input().split())
ans = 0
invs = getInv(N)
nCk = [1]*(N+1)
for i in range(1,N+1):
    nCk[i] = (nCk[i-1]*(N-i+1)*invs[i])%Q
for i in range(N+1):
    j = (K-A*i)//B
    if A*i + B*j == K and j <= N and 0 <= j:
        j = (K-A*i)//B
        ans = (ans + nCk[i]*nCk[j])%Q
print(ans)
### BUGGY CODE ###

N = int(input())
P = [int(i) for i in input().split()] 
C = N
for j in range(N):
	for i in range(N):
		if i > j:
			break
		else:
			if P[j] > P[i]:
				C -= 1
				break
print(C)

### FIXED CODE ###

N= int(input())
P = [int(i) for i in input().split()] 
C = N
D = P[0]
for i in range(1, N, 1):
	D = min(D,P[i])
	if D != P[i]:
		C -= 1
print(C)
### BUGGY CODE ###

#C - Low Elements
N = int(input())
P = list(map(int, input().split()))

x = N
ans=0
while x >=1:
    P = P[0:x]
    m=min(P)
    x=P.index(m)
    ans=ans+1
print(ans)

### FIXED CODE ###

#C - Low Elements
import numpy as np
N = int(input())
P = np.array(list(map(int, input().split())))
min=P[0]
ans=1
for i in range(1,N):
    if min > P[i]:
        min = P[i]
        ans = ans +1
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    b.append(a[i])
    b=b[::-1]
print(*b)

### FIXED CODE ###

from collections import deque

n=int(input())
a=list(map(int,input().split()))

b=deque()
for i in range(n):
    if (i+n)%2!=0:
        b.appendleft(a[i])
    else:
        b.append(a[i])
print(*b)
### BUGGY CODE ###

# coding: utf-8
# Your code here!

import numpy as np

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

s = input()

now = s[0]
tmp = 0

h = []
if s[0]=="0":
    h.append(0)

for i in s:
    if i != now:
        now = i
        h.append(tmp)
        tmp=0
    tmp+=1
h.append(tmp)

h = np.array(h)

ans = 0

for i in range(0,max(len(h),len(h)-k),2):
    ans = max(ans,sum(h[i:i+k*2+1]))
    
print(ans)

### FIXED CODE ###

# coding: utf-8
# Your code here!

import numpy as np

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

s = input()

now = s[0]
tmp = 0

h = []
if s[0]=="0":
    h.append(0)

for i in s:
    if i != now:
        now = i
        h.append(tmp)
        tmp=0
    tmp+=1
h.append(tmp)

h = np.array(h)

ans = 0

for i in range(0,max(len(h),len(h)-k),2):
    ans = max(ans,np.sum(h[i:i+k*2+1]))
    
print(ans)
### BUGGY CODE ###

from itertools import combinations
mod = int(1e9+7)
n, m = [int(num) for num in input().split()]

x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]

sumx = 0
for cmb in combinations(x, 2):
    sumx += cmb[1] - cmb[0]

sumy = 0
for cmb in combinations(y, 2):
    sumy += cmb[1] - cmb[0]

ans = (sumx % mod) * (sumy % mod) % mod

print(ans)

### FIXED CODE ###

# 予めsx, syを全て計算しておく
# このとき漸化式を使えば毎回全ての話を求める必要がない

mod = int(1e9+7)
n, m = [int(num) for num in input().split()]

x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]


sx = [0] * n
sx[0] = x[0]
for i in range(n-1):
    sx[i+1] = sx[i] + x[i+1]
sxd = 0  
for i in range(n-1):
    sxd += ((sx[n-1] - sx[i]) - x[i] * ((n-1) - (i+1) + 1)) % mod

sy = [0] * m
sy[0] = y[0]
for k in range(m-1):
    sy[k+1] = sy[k] + y[k+1]
syd = 0
for k in range(m-1):
    syd += ((sy[m-1] - sy[k]) - y[k] * ((m-1) - (k+1) + 1)) % mod

ans = ((sxd % mod) * (syd % mod)) % mod

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

# 初期入力
N= int(input())
S =input()

from collections import Counter
c = Counter(S)
count_all =c["R"] * c["G"] * c["B"]
count =0
for i,v in enumerate(S):
    for j in range(1,(N+1)//2):
        if  i+j*2 <N: 
            if S[i]=="R" and S[i+j] =="G" and S[i+j*2] =="B":
                #print(i-j,i,i+j)
                count +=1
            if S[i]=="R" and S[i+j] =="B" and S[i+j*2] =="G":
                #print(i-j,i,i+j)
                count +=1
            if S[i]=="G" and S[i+j] =="R" and S[i+j*2] =="B":
                #print(i-j,i,i+j)
                count +=1
            if S[i]=="G" and S[i+j] =="B" and S[i+j*2] =="R":
                #print(i-j,i,i+j)
                count +=1
            if S[i]=="B" and S[i+j] =="G" and S[i+j*2] =="R":
                #print(i-j,i,i+j)
                count +=1
            if S[i]=="B" and S[i+j] =="R" and S[i+j*2] =="G":
                count +=1
                #print(i-j,i,i+j)

print(count_all - count) 

      

### FIXED CODE ###

# 初期入力
N= int(input())
S =input()


#
R_index=[]
G_index=[]
B_index=[]
for i,v in enumerate(S):
    if v =="R":
        R_index.append(i)
    if v =="G":
        G_index.append(i)
    if v =="B":
        B_index.append(i)

# 例　R_index各要素から等距離離れたところに左にG、右にBがあればOK
R_B =[]
B_G =[]
count_ij_jk_onaji =0
for r in R_index:
    for g in G_index:
        if 0<=g-(r-g) and g-(r-g)<N  :
            #if S[g-(r-g)]=="B" and r<g:
            if S[g-(r-g)]=="B" :
                count_ij_jk_onaji +=1
               # print(r,g,g-(r-g),"B")
for b in B_index:
    for r in R_index:
        if 0<=r-(b-r) and r-(b-r)<N :
            #if S[r-(b-r)] == "G" and b<r:
            if S[r-(b-r)] == "G" :
                count_ij_jk_onaji +=1
                #print(r,b,r-(b-r),"G")
for g in G_index:
    for b in B_index:
        if 0<=b-(g-b) and b-(g-b)<N :
            #if S[b-(g-b)] =="R" and g<b:
            if S[b-(g-b)] =="R":
                count_ij_jk_onaji +=1
                #print(b,g,b-(g-b),"R")

            
#3つとも異なる文字=all
kotae_all = len(R_index) * len(G_index) * len(B_index) 
print(kotae_all -count_ij_jk_onaji)
### BUGGY CODE ###

import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
s = S()

cnt = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            n = 0
            abc = [a,b,c]
            for i in range(N):
                if int(s[i]) == abc[n]:
                    n += 1
                if n == 3:
                    cnt += 1
                    break
print(cnt)

### FIXED CODE ###

import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
s = S()

cnt = 0
for a in range(10):
    for b in range(10):
        n = 0
        ab = [a,b]
        for i in range(N):
            if int(s[i]) == ab[n]:
                n += 1
            if n == 2:
                for c in range(10):
                    for j in range(i+1,N):
                        if int(s[j]) == c:
                            cnt += 1
                            break
                else:
                    break
print(cnt)
### BUGGY CODE ###

n,k,q=map(int,input().split())
a=[int(input()) for i in range(q)]
for j in range(n):
    if k+a.count(j+1)-q>0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n,k,q=map(int,input().split())
a=[0]*n
for i in range(q):
  b=int(input())
  a[b-1]+=1
for i in range(n):
  if k-q+a[i]>0:
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

#import collections

N = int(input())
A = list(map(int, input().split()))
#A = [1, 2, 1, 4, 2, 1, 4, 1]

count_dic = {}
for i in A:
    C = A.count(i)
    count_dic[i] = C*(C-1)/2

for i in A:
    print(int(sum(count_dic.values())-(A.count(i)-1)))

### FIXED CODE ###


from collections import Counter
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
A_set = np.unique(A)
count_dict= Counter(A)
count_sum = np.sum([count_dict[i]*(count_dict[i]-1)/2 for i in A_set])

out = [int(count_sum-count_dict[i]+1) for i in A]
for i in out:
    print(i)