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

#coding:utf-8

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

for m in range(M):
    A[A.index(max(A))] = max(A)/2
total = sum(map(int, A))

print(total)


### FIXED CODE ###

#coding:utf-8

import heapq

N, M = map(int, input().split())
invA = []
for a in map(int, input().split()):
    heapq.heappush(invA, -1*a)
for m in range(M):
    heapq.heappush(invA, heapq.heappop(invA)/2)
total = -1*sum(map(int, invA))

print(total)
### BUGGY CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
dp = [[-1 for _ in range(n)] for _ in range(n)]
count = 0
for i in range(n):
    dp[i][i] = a[i] % m
    if dp[i][i] == 0:
        count += 1
for i in range(n):
    for j in range(i+1,n):
        dp[i][j] = (dp[i][j-1] + a[j]) % m
        if dp[i][j] == 0:
            count += 1
print(count)

### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
cum = [0] * (n+1)
for i in range(n):
    cum[i+1] = (cum[i] + a[i]) % m
d = {}
for i in cum:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
ans = 0
for i, count in d.items():
    ans += count * (count - 1) // 2
print(ans)
### BUGGY CODE ###

from scipy.misc import comb
from collections import Counter

N=int(input())
A=list(map(int,input().split() ))
B=[-1]*N   #メモ化。iの時の方法の総数

for i,item in enumerate(A):
  if B[item-1]>-1:
    #print(i,item,"は計算済み！")
    #print(i,B[item-1],"done")
    print(B[item-1])
  else:
    C=A[0:i]+A[i+1:] #仮で作るリスト
    cnt = Counter(C)
    D=dict(cnt)
    E=[]
    for item2 in D:
      if D[item2]>=2:
        E.append(D[item2])
    #print(i,E)
    opt=0
    for item3 in E:
      opt += comb(item3,2,exact=True)
    B[item-1]=opt
    #print(i,opt)
    print(opt)
    #print(i,E,opt)
    #print(C,cnt)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split() ))
from collections import Counter
d=dict(Counter(A))
#print(d)
cnt=0
for item in d:
    cnt += (d[item])*(d[item]-1)//2

#print("cnt",cnt)
   
for num in A:
    new = max(0, (d[num]-1)*(d[num]-2)//2)
    print(cnt- d[num]*(d[num]-1)//2 + new)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)


# 入力
N = int(input())
A = [float(x) for x in input().split()]

# DPテーブルを初期化
dp = [[[-1 for k in range(310)] for j in range(310)] for i in range(310)]


def rec(i, j, k):
    if dp[i][j][k] >= 0:
        return dp[i][j][k]
    if i == 0 and j == 0 and k == 0:
        return 0.0

    res = 0.0
    if i > 0:
        res += rec(i-1, j, k)*i
    if j > 0:
        res += rec(i+1, j-1, k)*j
    if k > 0:
        res += rec(i, j+1, k-1)*k
    res += N
    res *= 1.0/(i+j+k)

    dp[i][j][k] = res

    return res


one, two, three = 0, 0, 0
for a in A:
    if a == 1:
        one += 1
    elif a == 2:
        two += 1
    else:
        three += 1

# 答えを得て出力
print(rec(one, two, three))


### FIXED CODE ###

import collections

# 入力
N = int(input())
c = collections.Counter(list(map(int, input().split())))

# DPテーブルを初期化
dp = [[[0.0 for k in range(310)] for j in range(310)] for i in range(310)]


for k in range(0, c[3] + 1):
    for j in range(0, c[2]+c[3]-k + 1):
        for i in range(0, c[1]+c[2]+c[3]-j-k + 1):
            if i == j == k == 0:
                continue
            dp[i][j][k] = (N+i*dp[i - 1][j][k]+j *
                           dp[i + 1][j - 1][k]+k*dp[i][j + 1][k - 1])/(i+j+k)


# 答えを得て出力
print(dp[c[1]][c[2]][c[3]])
### BUGGY CODE ###

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

ans = 0
for r in range(3001):
    for g in range(3001):
        if (R*r+G*g) > N:
            break

        if (N-(R*r+G*g)) % B == 0 or R*r+G*g == N:
            ans += 1
print(ans)


### FIXED CODE ###

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

ans = 0
for r in range(3001):
    for g in range(3001):
        tmp = (R*r+G*g)
        if tmp > N:
            break

        if (N-tmp) % B == 0 or tmp == N:
            ans += 1
print(ans)
### BUGGY CODE ###

import sys
n = int(input())
a = [int(i) for i in input().split()]

b = 1
i = 0
pos = 0
while pos < n - 1:
    for j in a[pos:]:
        pos += 1
        if j == b:
            b += 1
            break
        else:
            i += 1
    if b == 1:
        print(-1)
        sys.exit()
print(i)

### FIXED CODE ###

import sys
n = int(input())
a = [int(i) for i in input().split()]
if not 1 in a:
    print(-1)
    sys.exit()
target = 1
count = 0
for i in a:
    if i == target:
        target += 1
    else:
        count += 1
print(count)
### BUGGY CODE ###

def addbit(i):
    i += 1
    while i <= N:
        BIT[i] += 1
        i += i & (-i)
def getsum(i):
    ret = 0
    i += 1
    while i != 0:
        ret += BIT[i]
        i -= i&(-i)
    return ret
def bit(L):
    global BIT
    BIT=[0] * (N+1)
    re = 0
    for l in L:
        re += getsum(l)
        addbit(l)
    return N*(N-1)//2 - re
def calc(Z):
    Z.sort()
    l, r, lc, rc = -1<<20, 1<<20, N*(N-1)//4+1, N*(N-1)//4+1
    if N <= 10000: l, r = -1<<32, 1<<32
    while r - l > 0.000000001:
        m = (l * rc + r * lc) / (lc + rc)
        A = [a&((1<<16)-1) for a in sorted([(int((s*m+t)*2**40)<<16)+i for i, (s, t) in enumerate(Z)])]
        c = bit(A)
        if c > N*(N-1)//4:
            l = m
            lc = ((c - N*(N-1)//4) * 2) ** 0.5
        else:
            r = m
            rc = ((N*(N-1)//4 - c) * 2 + 1) ** 0.5
    return l

N = int(input())
X, Y = [], []
for _ in range(N):
    a, b, c = map(int, input().split())
    X.append((-a/b, c/b))
    Y.append((-b/a, c/a))
print(calc(X), calc(Y))

### FIXED CODE ###

def addbit(i):
    i += 1
    while i <= N:
        BIT[i] += 1
        i += i & (-i)
def getsum(i):
    ret = 0
    i += 1
    while i != 0:
        ret += BIT[i]
        i -= i&(-i)
    return ret
def bit(L):
    global BIT
    BIT=[0] * (N+1)
    re = 0
    for l in L:
        re += getsum(l)
        addbit(l)
    return N*(N-1)//2 - re
def calc(Z):
    Z.sort()
    l, r, lc, rc = -1<<28, 1<<28, N*(N-1)//4+1, N*(N-1)//4+1
    f = 1
    while (r - l) / max(abs(l), 1) > 0.000000001:
        m = (l+r) / 2 if f else (l * rc + r * lc) / (lc + rc)
        A = [a&((1<<16)-1) for a in sorted([(int((s*m+t)*2**40)<<16)+i for i, (s, t) in enumerate(Z)])]
        c = bit(A)
        if c > N*(N-1)//4:
            l = m
            lc = (c - N*(N-1)//4) * 2
        else:
            r = m
            rc = (N*(N-1)//4 - c) * 2 + 1
        f ^= 1
    return l

N = int(input())
X, Y = [], []
for _ in range(N):
    a, b, c = map(int, input().split())
    X.append((-a/b, c/b))
    Y.append((-b/a, c/a))
print(calc(X), calc(Y))
### BUGGY CODE ###

#D
n = int(input())
s = input()
s_l = list(s)
cnt = 0
for i in range(n-2):
    for j in range(i,n-1):
        if s[i] != s[j]:
            for k in range(j,n):
                if s[i] != s[k] and s[j] != s[k]:
                    if j-i != k-j:
                        cnt += 1

print(cnt)
     

### FIXED CODE ###

#D
n = int(input())
s = input()
s_l = list(s)

a = s_l.count('R') * s_l.count('G') * s_l.count('B')
cnt = 0
#i,j,kがそれぞれ異なり、j-i = k-jであるものを求める
for i in range(n-2):
    for j in range(i,n-1):
        if 2*j - i < n:
            if s_l[i] != s_l[j] and s_l[i] != s_l[2*j-i] and s_l[j] != s_l[2*j-i]:
                cnt += 1
                
print(a - cnt)
### BUGGY CODE ###

#!/usr/bin/env python3
n,k = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]

shi = []
for i in range(max(p)):
    if i == 0:
        shi.append(1)
    else:
        shi.append(i+1+shi[i-1])

kitai = [shi[i]/(i+1) for i in range(len(shi))]

max = 0
for i in range(n-k+1):
    kt = 0
    for j in range(k):
        kt += kitai[p[i+j]-1]
    if kt > max:
        max = kt
print("{:.12f}".format(float(max)))

### FIXED CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))
maxn = 0
sum = 0
for i in range(n-k+1):
	if i == 0:
		for j in range(k):
			sum += p[j]
		maxn = sum
	else:
		sum -= p[i-1]
		sum += p[i+k-1]
		if maxn < sum:
			maxn = sum
print(0.5*(maxn+k))
### BUGGY CODE ###

import sys
import collections
import math
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    assert len(A) == N
    ball = collections.Counter(A)
    for k in range(N):
        total = []
        ball[A[k]] -= 1
        total = [combinations_count(i, 2) for i in ball.values() if i >= 2]
        ball[A[k]] += 1
        print(sum(total))


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import collections
import math
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    assert len(A) == N
    ball = collections.Counter(A)
    total = 0
    for i in ball.values():
        if i >= 2:
            total += combinations_count(i, 2)
    for k in range(N):
        if ball[A[k]] == 2:
            print(total - 1)
        elif ball[A[k]] == 1:
            print(total)
        else:
            print(total - ball[A[k]] + 1)


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

import copy
x,y = list(map(int, input().split()))
Z = [list(map(int, input().split())) for _ in range(x)]

def gonext(a,b):
    if a < x-1:
        a += 1
    else:
        b += 1
        a = 0
    return(a,b)

a, b = 0, 0
ans = []
visited = [[-1, -1], [-1, -1]]
stac = 0

count = 0
final = []
while a < x and b < y:
    now = Z[a][b]
    if now % 2 == 0:
        a,b = gonext(a,b)
    else:
        stac += 1
        if stac < 2:
            visited[0] = [a,b]
            a,b = gonext(a,b)
        else:
            visited[1] = [a,b]
            l0, l1 = visited
            
            while not l0 == l1:
                for i in range(2):
                    if l1[i] - l0[i] > 0:
                        l0_copy = copy.deepcopy(l0)
                        l0[i] += 1
                        for j in range(2):
                            l0_copy.append(l0[j])
                        count += 1
                        final.append(l0_copy)
            stac = 0
            a, b = gonext(a, b)
            ans.append(visited)
            visited = [[-1, -1], [-1, -1]]

print(count)
for i in final:
    k = [j+1 for j in i]
    print(" ".join(list(map(str, k))))


### FIXED CODE ###


import copy
y,x = list(map(int, input().split()))
Z = [list(map(int, input().split())) for _ in range(y)]

way = 1
a, b = 0, 0
ans = []
count = 0
while a < y and b < x:
    now = Z[a][b]
    a_copy= copy.deepcopy(a)
    b_copy = copy.deepcopy(b)

    if (way == 1 and a < y-1) or (way == -1 and a > 0):
        a += way
    else:
        b += 1
        way = way*(-1)
    if not (a < y and b < x):
        break
    if now % 2 == 1:
        Z[a][b] += 1
        ans.append([a_copy, b_copy, a, b])
        count += 1

print(count)
for i in ans:
    k = [j+1 for j in i]
    print(" ".join(list(map(str, k))))
### BUGGY CODE ###

A,B,C,K = (int(i) for i in input().split())
p = 0

for i in range(K):
	As = A
	Bs = B
	Cs = C
	A = Bs + Cs
	B = Cs + As
	C = As + Bs

u = A-B
if abs(u)>10*18:
	u = "Unfair"
print(u)

### FIXED CODE ###

A,B,C,K = (int(i) for i in input().split())
n = K % 2
if abs(A-B)>10**18:
	print("Unfair")
else:
	print((A-B)*((-1)**n))
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    print(a.count(i+1))


### FIXED CODE ###

from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
d = defaultdict(int)
for i in a:
    d[i]+=1
for i in range(n):
    print(d[i+1])
### BUGGY CODE ###

X=int(input())
A=X**(1/5)
A=round(A)
a=A**5
if(a<X):
    B=-1
    while(a-B**5!=X):
        B-=2
else:
    B=0
    while(a-B**5!=X):
        B+=1
print(A,B)

### FIXED CODE ###

X=int(input())
for i in range(121):
    a=i
    for j in range(121):
        b=j
        if(a**5-b**5==X):
            A=a
            B=b
        b=-j
        if(a**5-b**5==X):
            A=a
            B=b
print(A,B)
### BUGGY CODE ###

N, M = list(map(int, input().split()))
abc = []

for i in range(M):
  t = list(map(int, input().split()))
  k = list(map(int, input().split()))
  x = 0
  for j in k:
    x += (1 << (j - 1))
  abc.append(t + [x])

def nasu(n):
  ans = inf
  for i in range(1, n - 1):
    if ~n & i == 0:
      ans = min(ans, L[i] + L[n ^ i])
  return ans

inf = 10 ** 10
L = [inf] * (1 << N)

for i in range(1, N + 1):
  n = (1 << i) - 1
  while n < (1 << N):
    for j in range(M):
      if ~abc[j][2] & n == 0:
        L[n] = min(L[n], abc[j][0])
    L[n] = min(L[n], nasu(n))
    x = n & -n
    y = n + x
    n = ((n & ~y) // x >> 1) | y

if L[-1] == inf:
  print(-1)
else:
  print(L[-1])



### FIXED CODE ###

N, M = list(map(int, input().split()))
abc = []

for i in range(M):
  t = list(map(int, input().split()))
  k = list(map(int, input().split()))
  x = 0
  for j in k:
    x += (1 << (j - 1))
  abc.append(t + [x])

def nasu(n):
  ans = inf
  for i in range(1, n - 1):
    if ~n & i == 0:
      ans = min(ans, L[i] + L[n ^ i])
  return ans

inf = 10 ** 10
L = [inf] * (1 << N)

for i in range(1, N + 1):
  n = (1 << i) - 1
  while n < (1 << N):
    for j in range(M):
      if ~abc[j][2] & n == 0:
        L[n] = min(L[n], abc[j][0])
    L[n] = min(L[n], nasu(n))
    x = n & -n
    y = n + x
    n = ((n & ~y) // x >> 1) | y

if L[-1] == inf:
  print(-1)
else:
  print(L[-1])
### BUGGY CODE ###

from collections import deque
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
ans = [0] * k
q = deque(ans)
count = 0
for i in range(n):
    q.popleft()
    q.append(p[i])
    count = max(count, sum(q))
if count % 2 == 0:
    print(ex_even(count) + 0.5*(k-1))
else:
    print(ex_odd(count) + 0.5*(k-1))

### FIXED CODE ###

n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
s = sum(p[0:k])
s_max = sum(p[0:k])
for i in range(n-k):
    s = s-p[i] + p[i+k]
    s_max = max(s_max,s)
if s_max % 2 == 0:
    print(ex_even(s_max) + 0.5*(k-1))
else:
    print(ex_odd(s_max) + 0.5*(k-1))
### BUGGY CODE ###

n = int(input())
s = input()

ans = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            left = 0
            for i in range(n):
                if left == 0 and int(s[i]) == a:
                    left = 1
                elif left == 1 and int(s[i]) == b:
                    left = 2
                elif left == 2 and int(s[i]) == c:
                    left = 3
                if left == 3:
                    ans += 1
                    break


print(ans)
exit(0)


### FIXED CODE ###

n = int(input())
s = input()

t = [set() for _ in range(n)]
t[-1] = {int(s[-1])}

for i in range(1, n):
    base = t[n - i].copy()
    base.add(int(s[n - i - 1]))
    t[n - i - 1] = base

ans = 0
for a in range(10):
    ai = 0

    if a not in t[ai]:
        continue

    while ai < n:
        if s[ai] == str(a):
            break
        else:
            ai += 1
    if ai >= n - 2:
        continue
    for b in range(10):
        bi = ai + 1

        if b not in t[bi]:
            continue

        while bi < n:
            if s[bi] == str(b):
                break
            else:
                bi += 1
        if bi >= n - 1:
            continue
        for c in range(10):
            ci = bi + 1

            if c not in t[ci]:
                continue

            while ci < n:
                if s[ci] == str(c):
                    break
                else:
                    ci += 1
            if ci == n:
                continue
            else:
                ans += 1

print(ans)
exit(0)


x = int(input())
dp = [False for _ in range(x + 1)]
dp[0] = True
for item in [100, 101, 102, 103, 104, 105]:
    for i in range(x + 1):
        if i - item >= 0:
            if dp[i - item]:
                dp[i] = True

print(1 if dp[x] else 0)
exit(0)
### BUGGY CODE ###

def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    limit = 10**18
    ans = 1
    for i in A:
        ans *= i
    if ans > limit:
        print(-1)
    else:
        print(ans)

main()

### FIXED CODE ###

def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    if 0 in A:
        print(0)
        return

    limit = 10**18
    ans = 1
    for i in A:
        ans *= i
        if ans > limit:
            print(-1)
            return

    print(ans)

main()
### BUGGY CODE ###

s=input()
n=len(s)
d=dict(zip(list(range(2019)),[0]*2019))
d[0]=1
j=1
ans=0
now=0
for i in s[::-1]:
  now=(now+int(i)*j)%2019
  ans+=d[now]
  d[now]+=1
  j*=10
print(ans)

### FIXED CODE ###

s=input()
n=len(s)
d=[0]*2019
d[0]=1
j=1
ans=0
now=0
for i in s[::-1]:
  now=(now+int(i)*j)%2019
  ans+=d[now]
  d[now]+=1
  j*=10
  j%=2019
print(ans)
### BUGGY CODE ###

import math

n = int(raw_input())
a = raw_input().split()

cnt = 0
for i in a:
    a[cnt] = int(i)
    cnt += 1

chk = {}
def make_divisors(k):
    divisors = []
    for i in range(1, int(k**0.5)+1):
        if k % i == 0:
            if i in chk:
                chk[i] += 1
            else:
                chk[i] = 1
            if i != k // i:
                key = int(k//i)
                if key in chk:
                    chk[key] += 1
                else:
                    chk[key] = 1

    return divisors

if n == 2:
    print max(a[0],a[1])
else:
    for i in range(2):
        make_divisors(a[i])
    cnt = 1
    for i in range(2,len(a)):
        k = a[i]
        del_list = []
        for j in chk:
            if k % j == 0:
                chk[j] += 1
            if chk[j] < cnt+1:
                del_list.append(j)
        for j in del_list:
            del chk[j]
        cnt += 1

#    answer = max(chk.keys())
    answer = 0
    for i in chk:
        if int(chk[i]) >= n - 1 and i > answer:
            answer = i
    print answer

### FIXED CODE ###

n = int(raw_input())
a = raw_input().split()

cnt = 0
for i in a:
    a[cnt] = int(i)
    cnt += 1

chk = {}
chk2 = {}
def make_divisors(k):
    divisors = []
    for i in range(1, int(k**0.5)+1):
        if k % i == 0:
            if i in chk:
                chk[i] += 1
            else:
                chk[i] = 1
            if i != k // i:
                key = int(k//i)
                if key in chk:
                    chk[key] += 1
                else:
                    chk[key] = 1
    return divisors

for i in range(2):
    make_divisors(a[i])
cnt = 1
for i in range(2,len(a)):
    k = a[i]
    if k not in chk2:
        chk2[k] = 1
    else:
        if chk2[k] == 1:
            chk2[k] += 1
        elif chk2[k] > 1:
            continue
    del_list = []
    for j in chk:
        if k % j == 0:
            chk[j] += 1
        if chk[j] < cnt+1:
            del_list.append(j)
    for j in del_list:
        del chk[j]
    cnt += 1

answer = 0
for i in chk:
    if int(chk[i]) >= chk[1] - 1 and i > answer:
        answer = i
print answer
### BUGGY CODE ###

N, M = list(map(int, input().split()))
cons = (10**9+7)
if N == M:
    s = 1
    for i in range(2, N+1):
        s *= i
    print((s**2*2)%cons)

elif abs(N-M) == 1:
    N = min(N, M)
    s = 1
    for i in range(2, N+1):
        s *= i
    print((s*(s*(N+1))%cons))
else:
    print(0)


### FIXED CODE ###

import math

N, M = list(map(int, input().split()))
cons = (10**9+7)
if N == M:
    s = math.factorial(N)
    print((s**2*2)%cons)

elif abs(N-M) == 1:
    N = min(N, M)
    s = math.factorial(N)
    print((s*(s*(N+1))%cons))
else:
    print(0)
### BUGGY CODE ###

input()
s = list(map(int, input().split()))
#print(s)

ans = len(s)
for i in range(len(s)):
  x = s[i]
  y = x
  for j in range(i+1, len(s)):
    x = x + s[j]
    y = y ^ s[j]
    if x == y:
     ans += 1
    else:
      break

print(ans)

### FIXED CODE ###

def xor(x,y):
  return str(int(x)+y).replace("2", "0")
  
input()
s = list(map(int, input().split()))
t = list(map(lambda x: int(bin(x)[2:]), s))

ans = 0
r = 0
x = 0
y = "0"
for i in range(len(s)):
  ans += r - i
  for j in range(r, len(s)):
    nx = x + s[j]
    ny = xor(y, t[j])
    if bin(nx)[2:] == ny:
      ans += 1
      r += 1
      x = nx
      y = ny
    else:
      break
  x = x - s[i]
  y = xor(y, t[i])

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

from collections import deque

N,M,K = map(int,input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int,input().split())) for _ in range(K)]

f = [set() for _ in range(N+1)]
b = [set() for _ in range(N+1)]

for i,j in friend:
    f[i].add(j)
    f[j].add(i)
for i,j in block:
    b[i].add(j)
    b[j].add(i)

stack=deque()
linkList = []
ans = []
visited = [0] * (N+1)

for i in range(1,N+1):
    if visited[i]:
        continue
    link = [i]
    visited[i] = 1 
    stack.append(i)
    while stack:
        n = stack.pop()
        for j in f[n]:
            if j in f[n] and visited[j]==0:
                stack.append(j)
                visited[j] = 1
                link.append(j)
    linkList.append(link)

for i in range(1,N+1):
    #連結成分のサイズ
    linkSize = 0
    #「友達関係」または「ブロック関係」はマイナスする
    minus = 0
    for link in linkList:
        if not i in link:
            continue
        for j in link:
            linkSize = len(link)
            if i in f[j] or i in b[j]:
                minus += 1
    ans.append(linkSize-minus-1)
 
print(*ans)



### FIXED CODE ###

from collections import deque

N,M,K = map(int,input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int,input().split())) for _ in range(K)]

f = [set() for _ in range(N+1)]
b = [set() for _ in range(N+1)]

for i,j in friend:
    f[i].add(j)
    f[j].add(i)
for i,j in block:
    b[i].add(j)
    b[j].add(i)

stack=deque()
linkList = []
ans = [0] *(N+1)
visited = [0] * (N+1)

for i in range(1,N+1):
    if visited[i]:
        continue
    link = {i}
    visited[i] = 1 
    stack.append(i)
    while stack:
        n = stack.pop()
        for j in f[n]:
            if j in f[n] and visited[j]==0:
                stack.append(j)
                visited[j] = 1
                link.add(j)
    linkList.append(link)
    for i in link:
        ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1
print(*ans[1:])
### BUGGY CODE ###

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

count = [0] * (N+1)
for i in range(1,N+1):
    for j in range(N):
        if a[j] == i:
            count[i] += 1
            
for i in range(N):
    count_cp = count.copy()
    count_cp[a[i]] -= 1
    su = 0
    for j in range(1,N+1):
        if count_cp[j] > 1:
            su += count_cp[j]*(count_cp[j]-1)/2
    print(int(su))

### FIXED CODE ###

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

count = [0] * (N+1)
for aa in a:
    count[aa] += 1

su = 0
for ct in count:
    su += ct*(ct-1)/2
    
for aa in a:
    print(int(su-count[aa]+1))
### BUGGY CODE ###

import bisect
n = int(input())
l = [int(i) for i in input().split()]
l.sort()
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        t = bisect.bisect_left(l, l[i] + l[j])
        k = bisect.bisect_left(l, abs(l[i] - l[j]))
        if t > j:
            ans += t - max(k, j + 1)
print(ans)

### FIXED CODE ###

import bisect
n = int(input())
l = [int(i) for i in input().split()]
l.sort()
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        t = bisect.bisect_left(l, l[i] + l[j])
        if (t > j):
            ans += t - j - 1
print(ans)
### BUGGY CODE ###

n=int(input())
m=1
for i in range(1,n+1):
  m*=i
print(m%1000000007)


### FIXED CODE ###

import math
n = int(input())
print(math.factorial(n) % (10**9+7))