Harryxun/stf_run huggingface dataset:
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

if not (c12-c11 == c22-c21 == c32-c31):
    print("No")
    quit()
if not (c13-c12 == c23-c22 == c33-c32):
    print("No")
    quit()
if not (c21-c11 == c22-c12 == c23-c13):
    print("No")
    quit()
if not (c31-c21 == c32-c22 == c33-c23):
    print("No")
    quit()

print("Yes")

### FIXED CODE ###

from collections import Counter
N = int(input())
ans = Counter([int(input()) for _ in range(N)])
cnt = 0
for c in ans.values():
    if c%2 == 1:
        cnt += 1
print(cnt)
n = input()

def num2alpha(num):
    if num<=26:
        return chr(96+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(122)
    else:
        return num2alpha(num//26)+chr(96+num%26)


print(num2alpha(n))

### FIXED CODE ###

n = int(input())

def num2alpha(num):
    if num <= 26:
        return chr(96 + num)
    elif num % 26 == 0:
        return num2alpha(num // 26 - 1) + chr(122)
    else:
        return num2alpha(num // 26) + chr(96 + num % 26)

print(num2alpha(n))
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s = input()
a = [int(c) for c in s]
print (a[1]+a[2]+a[3])

### FIXED CODE ###

#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s = input()
a = [int(c) for c in s]
print (a[0]+a[1]+a[2])
ab=[]

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

for i in range(m):
    ab.append(tuple(map(int,input().split())))

ab.sort(key=lambda x:x[1])

res=0
for z in range(len(ab)):
    x=ab[0][1]
    if x==ab[-1][1]:
        res+=1
        break
    for j in range(len(ab)):
        if x > ab[0][0]:
            del ab[0]
            if len(ab)==0:
                res+=1
                break
        else:
            res+=1
            break
    
print(res)

### FIXED CODE ###

ab=[]

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

for i in range(m):
    ab.append(tuple(map(int,input().split())))

ab.sort(key=lambda x:x[1])

res=0
for z in range(len(ab)):
    x=ab[0][1]
    for j in range(len(ab)):
        if x > ab[0][0]:
            del ab[0]
        else:
            res+=1
            break
    if len(ab)==0:
        res+=1
        break
    
print(res)
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
if N<=K:
    print(0)
else:
    print(sum(H[0:N-K]))

### FIXED CODE ###

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

ans = 0

while H>0:
	ans += 1
	H -= A

print(ans)
n = int(input)
a=list(map(int,input().split()))
cnt,cnt2,cnt4=0,0,0
for val in a:
    if val%4==0:
        cnt4+=1
    elif val%2==0:
        cnt2+=1
    else:
        cnt+=1
if cnt2==n: print("Yes")
else:
    if cnt4>=cnt: print("Yes")
    else: print("No")

### FIXED CODE ###

n = int(input())
a=list(map(int,input().split()))
cnt,cnt2,cnt4=0,0,0
for val in a:
    if val%4==0:
        cnt4+=1
    elif val%2==0:
        cnt2+=1
    else:
        cnt+=1
if cnt2==n: print("Yes")
elif cnt2==0:
    if cnt4>=cnt-1: print("Yes")
    else: print("No")
else:
    if cnt4>=cnt: print("Yes")
    else: print("No")
while True:
    x = input()
    if x == "0":
        break
    num = [int(i) for i in x.split("")]
    print(sum(num))
     

### FIXED CODE ###

while True:
    x = input()
    if x == "0":
        break
    num = [int(i) for i in x]
    print(sum(num))
xn=input()
try:
  p=input()
except EOFError:
  x,n=xn.split()
  print(int(x))
else:
  x,n=xn.split()
  p={int(i) for i in p.split()}
  s={i for i in range(1,100)}
  s_p=list(s-p)
  d=[abs(i-int(x)) for i in s_p]
  print(s_p[d.index(min(d))])

### FIXED CODE ###

xn=input()
x,n=xn.split()
if n=='0':
  print(int(x))
else:
  p=input()
  p={int(i) for i in p.split()}
  s={i for i in range(-150,150)}
  s_p=list(s-p)
  d=[abs(i-int(x)) for i in s_p]
  print(s_p[d.index(min(d))])
import sys
input = sys.stdin.readline

N, M, V, P = map(int, input().split())
A = list(map(int, input().split()))
B = []
C = []

A.sort()
for _ in range(P-1):
    B.append(A.pop())
C.append(A.pop())
while C[-1] == A[-1]:
    C.append(A.pop())

A_length = len(A)
B_length = len(B)
C_length = len(C)
sm = sum(C)
count = 0

for _ in range(len(A)):
    now = A[-1]
    new = now + M
    threshhold = C
    remain = V - B_length - (A_length - count)
    if remain <= 0 and new >= C[0]:
        val = A.pop()
        C.append(val)
        sm += val
        count += 1
    elif sm <= new * (C_length + count) - remain*M:
        val = A.pop()
        C.append(val)
        sm += val
        count += 1
print(len(B+C))

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, M, V, P = map(int, input().split())
A = list(map(int, input().split()))
B = []
C = []

A.sort()
for _ in range(P-1):
    B.append(A.pop())

try:
    C.append(A.pop())
    while C[-1] == A[-1]:
        C.append(A.pop())
except:
    pass

A_length = len(A)
B_length = len(B)
C_length = len(C)
sm = sum(C)
count = 0

for _ in range(len(A)):
    now = A[-1]
    new = now + M
    threshhold = C
    remain = V - B_length - (A_length - count)
    if new >= C[0]:
        if remain <= 0:
            val = A.pop()
            C.append(val)
            sm += val
            count += 1
        elif sm <= new * (C_length + count) - remain*M:
            val = A.pop()
            C.append(val)
            sm += val
            count += 1
print(len(B+C))
A,B = map(int,input().split())
if A-2*B < 0:
  print(0)
else:
  print(A-2*b)
  

### FIXED CODE ###

A,B = map(int,input().split())
if A-2*B < 0:
  print(0)
else:
  print(A-2*B)
import math
a,b,c,d = map(int,input().split())
lcm = c*d // math.gcd(c,d)
A = ((a-1) // c) + ((a-1) // d) - ((a-1) // lcm) 
B = (b // c) + (b // d) - (b // lcm)
sum = B-A  #割り切れる個数
print( b-a+1-sum )

### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
lcm = c*d // fractions.gcd(c,d)
A = ((a-1) // c) + ((a-1) // d) - ((a-1) // lcm) 
B = (b // c) + (b // d) - (b // lcm)
ans = B-A
print(b-a+1-ans)
n,m=map(int,input().split())
x='No'
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
def c(i,j):
  global m,global a, global b
  for k in range(m):
    for l in range(m):
      if b[k][l]!=a[i+k][j+l]:
        return 0
  return 1
for i in range(n-m+1):
  for j in range(n-m+1):
    if c(i,j)==1:
      x='Yes'
      break
print(x)

### FIXED CODE ###

n,m=map(int,input().split())
x='No'
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
def c(i,j):
  global m
  global a
  global b
  for k in range(m):
    for l in range(m):
      if b[k][l]!=a[i+k][j+l]:
        return 0
  return 1
for i in range(n-m+1):
  for j in range(n-m+1):
    if c(i,j)==1:
      x='Yes'
      break
print(x)
import sys
read = lambda: sys.stdin.readline().rstrip()

def main():

	A0 = tuple(map(int, read().split()))

  	INF = 10 ** 20

    n,k = map(int,input().split())
    h = tuple(map(int,read().split()))
    dp = [INF]*(n+1)
    dp[0] = 0

    for step in range(1, k+1):
        for i in range(step,n):
            dp[i] = min(dp[i], dp[i-step]+abs(h[i]-h[i-step]))
 
	print(dp[n-1])

 
if __name__ == "__main__":
    main()

### FIXED CODE ###

N,K = map(int,input().split())
h = list(map(int,input().split()))
INF = 10**10
 
dp = [INF]*N
dp[0] = 0
 
for i,hi in enumerate(h):
    if i == 0:
        continue
    s = i-K if i-K >= 0 else 0
    dp[i] = min([dpk + abs(hi-hk) for dpk,hk in zip(dp[s:i],h[s:i])])
 
print(dp[-1])
khabarovsk 20
n = int(input())
dict = {}
for i in range(n):
    s, p = input().split()
    if s not in dict:
        dict[s] = []
    dict[s].append((int(p), i + 1))

for s in sorted(dict.keys()):
    for (p, i) in reversed(sorted(dict[s])):
        print(i)

### FIXED CODE ###

n = int(input())
dict = {}
for i in range(n):
    s, p = input().split()
    if s not in dict:
        dict[s] = []
    dict[s].append((int(p), i + 1))

for s in sorted(dict.keys()):
    for (p, i) in reversed(sorted(dict[s])):
        print(i)
import sys

x = sys.stdin.readline()

x_list = x.split(" ")

max = int(x_list[0])
maxNo = 0
min = int(x_list[0])
minNo = 0

for i in range(1,3):
  if max < int(x_list[i]):
    max = int(x_list[i])
    maxNo = i
  elif min > int(x_list[i]):
    min = int(x_list[i])
    minNo = i

if (max == 0 and min == 1) or (max == 1 and min == 0):
  mid == int(x_list[2])
elif (max == 0 and min == 2) or (max == 2 and min == 0):
  mid == int(x_list[1])
else:
  mid == int(x_list[0])

print "%s %s %s" %(max, mid, min)

### FIXED CODE ###

x = raw_input()
x_list = x.split(" ")

x_list = map(int, x_list)

max = min = mid = 0
for i in range(1,3):
    if x_list[max] < x_list[i]:
        mid = max
        max = i
    elif x_list[min] > x_list[i]:
        mid = min
        min = i
    else:
        mid = i

print("%d %d %d" %(x_list[min], x_list[mid], x_list[max]))
from collections import defaultdict
d = defaultdict(int)

n = int(input())
for _ in range(n):
    d[input()] += 1
m = int(input())
for _ in range(n):
    d[input()] -= 1
print(max(d.values()))

### FIXED CODE ###

from collections import defaultdict
d = defaultdict(int)

n = int(input())
for _ in range(n):
    d[input()] += 1
m = int(input())
for _ in range(m):
    d[input()] -= 1
print(max(0, max(d.values())))
import math
I = input().split()
A = int(I[0])
B = int(I[1])
N = int(I[2])
def fl(x):
    return math.floor((A*x)/B) - A*math.floor(x/B)

An = fl(N)

if A == 1 : 
    if  B == 1 :
        An = int(0)

if B < N :
    for i in range(B,N) :
        if i >= B+1 and fl(i) <= fl(i-1) :
            An = fl(i-1)
            break
elif B == N :
    An = fl(N-1)

print(str(An))

### FIXED CODE ###

I = [input() for i in range(2)]
K = int(I[0])
S = I[1].split()
A = int(S[0])
B = int(S[1])

na = A//K
nb = B//K

la = A%K
lb = B%K

#print(na)
#print(nb)

if na < nb or la == 0 or lb == 0 :
    ans = 'OK'
else:
    ans = 'NG'

print(ans)
a = int(input())
b = int(input())

if a >= 0 and a <= 5:
    print(0)
if a >= 6 and a <= 12:
    print(b//2)
if a >= 16 and a <= 100:
    print(b)


### FIXED CODE ###

line = input().split()
a = int(line[0])
b = int(line[1])


if a >= 0 and a <= 5:
    print(0)
if a >= 6 and a <= 12:
    print(b//2)
if a >= 13 and a <= 100:
    print(b)
N=int(input())
A=list(map(int,input().split()))
A.sort()
print(A[N]-A[0])

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
A.sort()
print(A[N-1]-A[0])
n = int(input())
lst = str(input()).split(' ')

p1 = lst[0]
p2 = lst[1]
new_lst = []
for idx in range(n):
	if idx%2 == 0:
  		new_lst.append(p1)
	else:
		new_lst.append(p2)

cnt = 0
for o, l in zip(lst, new_lst):
	if not o == l:
		cnt +=1
if p1 == p2:
  print(int(n/2))
else:
  print(cnt)

### FIXED CODE ###

n = str(input())
one_idx = []
nine_idx = []
for idx in range(len(n)):
	if n[idx]=='1':
		one_idx.append(idx)
	if n[idx]=='9':
		nine_idx.append(idx)

out = ''
for idx in range(len(n)):
	if idx in one_idx:
		out += '9'
	if idx in nine_idx:
		out += '1'
          
print(out)
W,H,x,y,r=map(int,input().split())
if W-x>r&&x>r&&H-y>r&&y>r:
 print('Yes')
else:
 print('No')

### FIXED CODE ###

W,H,x,y,r=map(int,input().split())
if W-x>=r and x>=r and H-y>=r and y>=r:
 print('Yes')
else:
 print('No')
print(180*(int(input()-2)))


### FIXED CODE ###

print(180*(int(input())-2))
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b') 
elif a > b:
    ptint('a > b')
else:
    print('a == b')
    

### FIXED CODE ###

nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')
import sys
from collections import defaultdict
sys.setrecursionlimit(10**18)
finput=lambda:sys.stdin.readline().strip()

class Unionfind():
    def __init__(self,n):
        self.parents=[-1]*n
        self.ranks=[0]*n
    
    def find(self,x):
        if self.parents[x]<0:
            return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]
    
    def union(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if x==y:
            return 
        if self.ranks[x]<self.ranks[y]:
            x,y=y,x
        self.parents[x]+=self.parents[y]
        self.parents[y]=x
        if self.ranks[x]==self.ranks[y]:
            self.ranks[x]+=1
    
    def size(self,x):
        return -self.parents[self.find(x)]
    
    def issametree(self,x,y):
        return self.find(x)==self.find(y)

def main():
    n=int(finput())
    xy=dict((tuple(map(int,finput().split())),i) for i in range(n))
    coor=sorted(list(iter(xy)),key=lambda e:e[0])
    cost = lambda e,f:min(abs(e[0]-f[0]),abs(e[1]-f[1]))
    ew=dict(((xy[coor[i]],xy[coor[i+1]]),cost(coor[i],coor[i+1]))for i in range(n-1))
    coor.sort(key=lambda e:e[1])
    ew.update(dict(((xy[coor[i]],xy[coor[i+1]]),cost(coor[i],coor[i+1]))for i in range(n-1)))
    edges=sorted(list(iter(ew)),key=lambda e:ew[e])
    v=Unionfind(n)
    totcost=0
    # print(ew)
    # print(edges)
    for edge in edges:
        if not v.issametree(edge[0],edge[1]):
            v.union(edge[0],edge[1])
            totcost+=ew[edge]
    print(totcost)
    
if __name__=='__main__':
    main()


### FIXED CODE ###

import sys
from collections import defaultdict
finput=lambda:sys.stdin.readline().strip()

class Unionfind():
    def __init__(self,n):
        self.parents=[-1]*n
        self.ranks=[0]*n
    
    def find(self,x):
        if self.parents[x]<0:
            return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]
    
    def union(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if x==y:
            return 
        if self.ranks[x]<self.ranks[y]:
            x,y=y,x
        self.parents[x]+=self.parents[y]
        self.parents[y]=x
        if self.ranks[x]==self.ranks[y]:
            self.ranks[x]+=1
    
    def size(self,x):
        return -self.parents[self.find(x)]
    
    def issametree(self,x,y):
        return self.find(x)==self.find(y)

def main():
    n=int(finput())
    coor=[list(map(int,finput().split()))+[i] for i in range(n)]
    coor.sort(key=lambda e:e[0])
    cost = lambda e,f:min(abs(e[0]-f[0]),abs(e[1]-f[1]))
    ew=dict(((coor[i][2],coor[i+1][2]),cost(coor[i][:2],coor[i+1][:2])) for i in range(n-1))
    coor.sort(key=lambda e:e[1])
    ew.update(dict(((coor[i][2],coor[i+1][2]),cost(coor[i][:2],coor[i+1][:2])) for i in range(n-1)))
    edges=sorted(list(iter(ew)),key=lambda e:ew[e])
    v=Unionfind(n)
    totcost=0
    # print(ew)
    # print(edges)
    for edge in edges:
        if not v.issametree(edge[0],edge[1]):
            v.union(edge[0],edge[1])
            totcost+=ew[edge]
    print(totcost)
    
if __name__=='__main__':
    main()
N = int(input())
input_list = sorted([int(i) for i in input().split()])

mod = 10 ** 9 + 7

if N = 1 and input_list[0] == 0:
    print(1)

if N % 2 == 1:
    if input_list[0] != 0:
        print(0)
    else:
        flag = 2
        limit = (N - 1) // 2
        for i in range(1, limit, 2):
            if input_list[i] == flag and input_list[i+1] == flag:
                flag += 2
                if i == limit-1:
                    print((2**limit) % mod)
            else:
                print(0)
                break
elif N % 2 == 0:
    flag = 1
    limit = N // 2
    for i in range(0, limit, 2):
        if input_list[i] == flag and input_list[i+1] == flag:
            flag += 2
            if i == limit-2:
                print((2**limit) % mod)
        else:
            print(0)
            break


# 5
# 4 2 0 2 4

### FIXED CODE ###

N = int(input())
input_list = sorted([int(i) for i in input().split()])

mod = 10 ** 9 + 7

if N % 2 == 1:
    if input_list[0] != 0:
        print(0)
    else:
        if N == 1:
            print(1)
        flag = 2
        limit = (N - 1) // 2
        for i in range(1, limit, 2):
            if input_list[i] == flag and input_list[i+1] == flag:
                flag += 2
                if i == limit-1:
                    print((2**limit) % mod)
            else:
                print(0)
                break
elif N % 2 == 0:
    flag = 1
    limit = N
    for i in range(0, limit, 2):
        if input_list[i] == flag and input_list[i+1] == flag:
            flag += 2
            if i == limit-2:
                print((2**(N//2)) % mod)
                break
        else:
            print(0)
            break
A = int(input())
B = int(input())
print('GREATER' if A > B else 'LESS' if A < B else 'EQUAL')

### FIXED CODE ###

s1,s2,s3 = input().split()
s = s1[0].upper() + s2[0].upper() + s3[0].upper()
print(s)
N = input()
aryA = input().split(" ")

N = int(N)
aryA = [int(s) for s in aryA]
n = len(aryA)

tot = []
totlist = []
b = N

for m in range(b):
    for x in range(n):
        tot.append(abs(aryA[x] - (m + x + 1)))
    totlist.append(sum(tot))

print(min(totlist))

### FIXED CODE ###

N = input()
N = int(N)
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

print(lcm(2, N))
mod = 10**9+7
N = int(input())
Ca = [int(input())-1 for i in range(N)]
C = []
p = -1
for c in Ca:
    if p != c:
        C.append(c)
    p = c
#print(C)
N = len(C)
if N<=2:
    print(1)
    exit()
L = [-1]*N
dp = [0]*N
dp[0] = 1
L[C[0]] = 0


for i, c in enumerate(C[1:], 1):
    if L[c] == -1:
        L[c] = i
        dp[i] = dp[i-1]
        continue
    else:
        dp[i] = (dp[i-1] + dp[L[c]]) % mod
        L[c] = i
print(dp[-1])


### FIXED CODE ###

mod = 10**9+7
N = int(input())
Ca = [int(input())-1 for i in range(N)]
C = []
p = -1
for c in Ca:
    if p != c:
        C.append(c)
    p = c
#print(C)
N = len(C)
if N<=2:
    print(1)
    exit()
L = [-1]*(2*10**5)
dp = [0]*N
dp[0] = 1
L[C[0]] = 0


for i, c in enumerate(C[1:], 1):
    if L[c] == -1:
        L[c] = i
        dp[i] = dp[i-1]
        continue
    else:
        dp[i] = (dp[i-1] + dp[L[c]]) % mod
        L[c] = i
print(dp[-1])
n = num(input())
l = list(input())
if l.count("R") > int(n/2):
  print("Yes")
else:
  print("No")



### FIXED CODE ###

n = int(input())
l = list(input())
if l.count("R") > int(n/2):
  print("Yes")
else:
  print("No")
N=int(input())
l = list(map(int, input().split()))

count=0

while True:
  for i in range(len(l)):
    if l[i]%2==0:
        l[i] //= 2
        else:
            print(count)
            exit()
    count += 1
  
      

### FIXED CODE ###

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

count=0

while True:
  for i in range(len(l)):
    if l[i]%2==0:
        l[i] //= 2
    else:
        print(count)
        exit()
    
  count += 1
# 検証のためのACの人のパクリですごめんなさい
N = int(input())
hs = [i for i in map(int, input().split())]

INF = 10*12
dp = [INF]*N

dp[0] = 0
dp[1] = abs(ha[0]-hs[1])
for i in range(2, N):
  dp[i] = min(dp[i-1] +abs(hs[i]-hs[i-1]), dp[i-2] +abs(hs[i]-hs[i-2]))
print(dp[-1])

### FIXED CODE ###

# 検証のためのACの人のパクリですごめんなさい
N = int(input())
hs = [i for i in map(int, input().split())]

INF = 10*12
dp = [INF]*N

dp[0] = 0
dp[1] = abs(hs[0]-hs[1])
for i in range(2, N):
  dp[i] = min(dp[i-1] +abs(hs[i]-hs[i-1]), dp[i-2] +abs(hs[i]-hs[i-2]))
print(dp[-1])
lis = [ int(i) for i in input().split]
a = lis[0]
b = lis[1]
if b*2 > a:
  print(0)
else:
  print(a - b*2)

### FIXED CODE ###

lis = [ int(i) for i in input().split()]
a = lis[0]
b = lis[1]
if b*2 > a:
  print(0)
else:
  print(a - b*2)
sys.setrecursionlimit(2000)

def text_match_words(text, words):
	match_words = []
	for word in words:
		if word == text[:len(word)]:
			match_words.append(word)
	return match_words

def is_match_for(text, words):
	if "" == text: 
		return True
	else:
		match_words = text_match_words(text, words)
		if [] == match_words:
			return False
		else:
			return any([is_match_for(text[len(match_word):], words) for match_word in match_words])

words = ("dream", "dreamer", "erase", "eraser")

s = input()

if is_match_for(s, words):
	print("YES")
else:
	print("NO")

### FIXED CODE ###

import re

if re.match("(dream|dreamer|erase|eraser)*$", input()):
    print("YES")
else:
    print("NO")
import math
a, b, x = map(int,input().split())
if a % x != 0:
    print(b//x - a//x + 2)
else
    print(b//x - a/x + 1)

### FIXED CODE ###

import math
a, b, x = map(int,input().split())
print(b//x - (a-1)//x)
a, b, k = map(int, input().split())
after_a = max(0, a - k)
if after_a == 0:
    k -= a
    after_b = max(0, b - k)

print(after_a, after_b)

### FIXED CODE ###

a, b, k = map(int, input().split())
after_a = max(0, a - k)
after_b = b
if after_a == 0:
    k -= a
    after_b = max(0, b - k)

print(after_a, after_b)
from scipy.special import comb

inp = input().split()

N = int(inp[0])
K = int(inp[1])

for i in range(1, K+1):
    print("%d"%(comb(N-K+1, i)*comb(K-1, i-1)%1000000007))

### FIXED CODE ###

from math import factorial

def comb(n, k):
    return factorial(n)//factorial(k)//factorial(n-k)

inp = input().split()

N = int(inp[0])
K = int(inp[1])

for i in range(1, K+1):
    if(i > N-K+1):
        print(0)
    else:
        print("%d"%(comb(N-K+1, i)*comb(K-1, i-1)%1000000007))
N, M = map(int, input().split())
drink = []
cost = 0
count = 0
d_count = 0
rest = 0
 
 
for _ in range(N):
    drink.append(list(map(int, input().split())))
    drink.sorted()
 
for i in range(N):
    cost += drink[i][0] * drink[i][1]
    d_count += drink[i][1]
    count += 1
    if d_count > M:
      break
      
cost -= drink[count-1][0] * drink[count-1][1]
d_count -= drink[count-1][1]
rest = M - d_count
cost += rest * drink[count-1][0]
print(cost)

### FIXED CODE ###

N, M = map(int, input().split())
drink = []
cost = 0
d_count = 0


for _ in range(N):
    drink.append(list(map(int, input().split())))
    
drink = sorted(drink)

for i in range(N):
    cost += drink[i][0] * drink[i][1]
    d_count += drink[i][1] 
    if d_count > M:
      cost -= drink[i][0] * (d_count - M)
      break
      

print(cost)
p=lambda x:print(f'{x//3600:02}:{x//60%60:02}:{x%60:02}')
for e in iter(input,'-1\n'):
 h,m,s=map(int,e.split())
 d=7200-h*3600-m*60-s
 p(d);p(d*3)


### FIXED CODE ###

p=lambda x:print(f'{x//3600:02}:{x//60%60:02}:{x%60:02}')
for e in iter(input,'-1 -1 -1'):
 h,m,s=map(int,e.split())
 d=7200-h*3600-m*60-s
 p(d);p(d*3)
a,b=map(int, input().split())
d = a/b
r = a%b
f = a/b
print(???{0} {1} {2:f}???.format(d, r, f))

### FIXED CODE ###

a, b = map(int, input().split())
d = a // b
r = a % b
f = a / b
print('{0:d} {1:d} {2:f}'.format(d, r, f))
s,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())))[-x-y:]
q=sorted(list(map(int,input().split())))[-x-y:]
r=sorted(list(map(int,input().split())))
for i in range(len(p)):
  r.append(p[i])
  r.append(q[i])
r=sorted(r)[-x-y:]
print(sum(r))



### FIXED CODE ###

x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())))[-x:]
q=sorted(list(map(int,input().split())))[-y:]
r=sorted(list(map(int,input().split())))
for i in range(len(p)):
  r.append(p[i])
for i in range(len(q)):
  r.append(q[i])
r=sorted(r)[-x-y:]
print(sum(r))
A=int(input())
B=float(input())
C=int(A*B)
print=C

### FIXED CODE ###

A,B=input().split()
A=int(A)
B=list(B)
N=B[0]+B[2]+B[3]
N=int(N)
C=int(A*N//100)
print(C)
n = int(input())
a = list(map(int, input().split()))
import collections

c = collections.Counter(a)
values, counts = zip(*c.most_common())
if counts[-1] == 1:
	k = counts.index(1)
	del counts[k:]


from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

from collections import deque
t = deque()
for i in counts:
    t.append(cmb(i,2))

t = list(t)
ans = sum(t)

for i in a:
	print(ans - c[i] + 1)


### FIXED CODE ###

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

c = collections.Counter(a)
values, counts = zip(*c.most_common())
counts = list(counts)
if counts[-1] == 1:
	k = counts.index(1)
	del counts[k:]


from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

from collections import deque
t = deque()
for i in counts:
    t.append(cmb(i,2))

t = list(t)
ans = sum(t)

for i in a:
	print(ans - c[i] + 1)