Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import numpy as np

N, M = map(int, input().split())
a = []
b = []

for j in range(M):
    ta, tb = map(int, input().split())
    a.append(ta)
    b.append(tb)

# print(a)
# print(b)

br_tbl = np.zeros((N-1, M), dtype=np.bool)
for j in range(M):
    for i in range(a[j]-1,b[j]-1):
        br_tbl[i,j] = 1

max_list = []
skip_list = np.zeros((M), dtype=np.bool)
br_cnt = 0
for j in range(M):
    # print('j=',j)
    max_col = 0
    if skip_list[j] == 1:
        continue
    sum_list = np.zeros((N-1), dtype=np.uint)
    for i in range(N-1):
        if  br_tbl[i,j] == 1:
            # print('i=',i)
            sum = 0
            for j2 in range(j,M):
                # print('j2=',j2)
                sum += br_tbl[i,j2]
            sum_list[i] = sum
            # print(sum)
    max_col = np.argmax(sum_list)
    max_list.append(max_col)
    # print('sum_list=',sum_list)
    # print('max_col=',max_col)
    br_cnt += 1

    for j3 in range(j,M):
        # print('j3=',j3)
        if br_tbl[max_col,j3] == 1:
            skip_list[j3] = 1
#     print(skip_list)
#
# print()
# print(br_tbl)

print(br_cnt)


### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import deque
N, M = map(int, input().split())
abn = [list(map(int, input().split())) for _ in range(M)]

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

ans = 0
bnum = -1
for a,b in abn:
    if bnum == -1:
        bnum = b - 1
        ans += 1
    elif a <= bnum < b:
        continue
    else:
        bnum = b - 1
        ans += 1

print(ans)
N = int(input())
A = list(map(float,input().split()))
K = N//2 + 1


def dfs(i,K):
    if (i,K) in cache: return cache[(i,K)]
    if K < 0: 
        cache[(i,K)] = 1
        return 1
    if i>=N: 
        cache[(i,K)] = 1
        return 1
    if len(A[i:]) < K: 
        res = (1-A[i])*dfs(i+1,K)
    elif len(A[i:]) == K: 
        res = A[i]*dfs(i + 1,K-1)
    else:
        res = A[i]*dfs(i+1,K-1) + (1-A[i])*dfs(i+1,K)
    cache[(i,K)] = res
    return res
cache={}
print(dfs(0,K))
            



### FIXED CODE ###

import collections
N = int(input())
A = list(map(float,input().split()))
K = N//2  + 1
dp = [[0 for _ in range(N + 1) ] for _ in range(N + 1)]
if N == 0: 
    print(0)
    exit
dp[0][0] = 1
ans = 0
for i in range(1,N+1):
    for j in range(i+1):
        if j - 1 < 0:
            dp[i][j] = dp[i-1][j]*(1-A[i-1])
        else:
            dp[i][j] = dp[i-1][j-1]*A[i-1] + dp[i-1][j]*(1-A[i-1])
for i in range(K,len(dp[N])):
        ans+=dp[N][i]
print(ans)
#a, b, c = map(int, input(). split())
na = list(map(int, input(). split()))
#print(dir(ns))
ns. sort()
#print(ns[0], ns[1], ns[2])
print(ns)
print(*ns)



### FIXED CODE ###

a = list(map(int, input().split()))
a.sort()
print(a[0], a[1], a[2])
A,B,C,X=[int(input()) for i in range(4)]
cnt = 0
for a in range(0,A+1):
    Y = X - 500*a
    if Y==0:
        cnt += 1
        continue
    elif Y<0:
        continue
    for b in range(0,B+1):
        Z = Y - 100*b
        if Z==0:
            cnt += 1
            continue
        elif Z<0:
            continue
        if W == 0:
            cnt += 1
print(cnt)

### FIXED CODE ###

a,b,c,X=[int(input()) for i in range(4)]
print([500*x+100*y+50*z for z in range(c+1) for y in range(b+1) for x in range(a+1)].count(X))
a,b = map(int,input().split())
print("Possible" if (A+B)%3 == 0 else "Impossible")

### FIXED CODE ###

a,b = map(int,input().split())
print("Possible" if a*b*(a+b)%3==0 else "Impossible")
l=[int(x) for x in input().split()]
N=l[0]
R=l[1]
ans = 0

if N  <= 10:
  ans = R
  print(ans)
else:
  ans = R + 100*(10-k)
  print(ans)


### FIXED CODE ###

l=[int(x) for x in input().split()]
N=l[0]
R=l[1]

if N >= 10:
  ans = R
  print(ans)
else:
  ans = R + 100*(10-N)
  print(ans)
A,B,C = map(int,input().split())
found = False
for i in range(1,B+1):
    if A * i % B == C:
        found = True
if found = True:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

A,B,C = map(int,input().split())
i = 1
ans = "NO"
modlist = []
while True:
    if (B * i + C) % A == 0:
        ans = "YES"
        break
    else:
        modlist.append((B * i + C) % A)
        i += 1
    if len(modlist) != len(set(modlist)):
        break
print(ans)
n = int(input())

for i in range(0, n):
    data = list(map(int, input().split(' ')))
    for j in range(0, 3):
        if data[j%3] < data[(j+1)%3] + data[(j+2)%3]:
            continue
        else:
            print('NO')
            exit(1)
    print('YES')

### FIXED CODE ###

n = int(input())

for i in range(0, n):
    data = sorted(list(map(int, input().split(' '))))
    if data[2]**2 == data[1]**2 + data[0]**2:
        print('YES')
    else:
        print('NO')
from fractions import gcd
N=int(input())
a = list(map(int, input().split()))
lcm = 1
for i in range(N):
    lcm = lcm * a[i] // gcd(ans, a[i])
import numpy as np
aa = np.array(a)
print(sum(lcm//aa)%(10**9+7))

### FIXED CODE ###

from fractions import gcd
N=int(input())
a = list(map(int, input().split()))
lcm = 1
for i in a:
    lcm = lcm * i // gcd(lcm, i)
ans = 0
for i in a:
    ans += (lcm//i)#%(10**9+7)
print(ans%(10**9+7))
n = int(input())
S = input()

R = []
G = []
B = []

for i in range(n):
    if S[i] == 'R':
        R.append(i)
    elif S[i] == 'G':
        G.append(i)
    else:
        B.append(i)

#print(R, G, B)

cnt = 0
r = R[0]
g = G[0]
b = B[0]

iR = 0
iG = 0
iB = 0

def ccc(ia, ib, ic, BB, CC):
    cnt = 0
    for aa in BB[ib:]:
        if aa > ia:
            for aaa in CC[ic:]:
                if aaa > aa:
                    if (aa - ia) != (aaa - aa):
                        #print(ia, aa, aaa)
                        cnt += 1
    return cnt

for i in range(n):
    if S[i] == 'R':
        iR += 1
        cnt += ccc(i, iG, iB, G, B)
        cnt += ccc(i, iB, iG, B, G)
    elif S[i] == 'G':
        iG += 1
        cnt += ccc(i, iR, iB, R, B)
        cnt += ccc(i, iB, iR, B, R)      
    else:
        iB += 1
        cnt += ccc(i, iG, iR, G, R)
        cnt += ccc(i, iR, iG, R, G)
    
print(cnt)
# c = 0
# for i in range(n):
#     for j in range(i + 1, n):
#         if s[i] != s[j]:
#             for k in range(j + 1, n):
#                 if j - i == k - j:
#                     continue
#                 if s[i] != s[k] and s[j] != s[k]:
#                     c += 1
# print(c)

### FIXED CODE ###

n = int(input())
S = input()

R = {}
G = {}
B = {}

for i in range(n):
    if S[i] == 'R':
        R[i] = None
    elif S[i] == 'G':
        G[i] = None
    else:
        B[i] = None

#print(R, G, B)

cnt = 0

cnt = len(R) * len(G) * len(B)

for b in B:
    for g in G:
        if (b + g) / 2 in R:
            cnt -= 1

for r in R:
    for b in B:
        if (r + b) / 2 in G:
            cnt -= 1

for r in R:
    for g in G:
        if (r + g) / 2 in B:
            cnt -= 1
            
print(cnt)
a, b = map(int, input().split())
for i in range(1,1009):
    if int(i*0.08) == a and int(i*0.1) == b:
        print(int(i))
print("-1")

### FIXED CODE ###

s = input()
if "AB" in s or "BA" in s:
    print("Yes")
else:
    print("No")
A="AKIHABARA"
s=input()
n=len(s)
na=len(A)
i=0
j=0
while i<n j<na-1:
  if s[i]==A[j]:
    i+=1; j+=1
  elif s[i]!=A[j] and A[j]=="A":
    j+=1
  else:
    break
if j==n-1:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

A="AKIHABARA"
data=[0,4,6,8]
AD=list(A)
S=set(); S.add(A)
for i in range(2):
    for j in range(2):
        for k in range(2):
            for l in range(2):
                tmp=AD.copy()
                # print(AD)
                # print(tmp)
                if i: tmp[0]=""
                if j: tmp[4]=""
                if k: tmp[6]=""
                if l: tmp[8]=""
                S.add(''.join(tmp))


s=input()
if s in S:
    print("YES")
else:
    print("NO")
from collections import deque

if __name__ == '__main__':
    n, q = input().split()
    n, q = int(n), int(q)
    S = [deque([]) for i in range(n)]

    for i in range(q):
        query = input().split()

        if query[0] == '0':
            S[int(query[1])].append(query[2])

        else:
            if len(S) == 0:
                pass
            elif query[0] == '1':
                print(S[int(query[1])][-1])
            else:
                S[int(query[1])].pop()


### FIXED CODE ###

from collections import deque

if __name__ == '__main__':
    n, q = input().split()
    n, q = int(n), int(q)
    S = [deque([]) for i in range(n)]

    for i in range(q):
        query = input().split()

        if query[0] == '0':
            S[int(query[1])].append(query[2])

        else:
            if len(S[int(query[1])]) == 0:
                pass
            elif query[0] == '1':
                print(S[int(query[1])][-1])
            else:
                S[int(query[1])].pop()
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N,K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
max=0
min=0
for i in range(K-1,N):
    max+=A[i]*comb(i,K-1)

for i in range(N-K+1):
    min+=A[i]*comb(N-1-i,K-1)
ans=(max-min)%(10**9 +7)
print(ans)


### FIXED CODE ###

C = input()
H = [chr(i) for i in range(97,97+26)]
l = len(H)
for i in range(l):
    if (C==H[i]):
        ans=H[i+1]
print(ans)
n = int(raw_input())
  
d = [99999 for i in range(n)]
G = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
  
def BFS(s):
    for e in range(n):
        if M[s][e] == 1:
            if d[e] > d[s] + 1:
                d[e] = d[s]+1
                BFS(e)
  
for i in range(n):
    G = map(int, raw_input().split())
    for j in range(G[1]):
        M[G[0]-1][G[2+j]-1] = 1
  
d[0] = 0
for s in range(n):
        BFS(s)
for s in range(n):
    if d[s] == 99999:
        d[s] = -1
for s in range(n):
    print'{0} {1}'.format(s+1, d[s])
 

 
Compile Error Logs: 

You are not authorized to see the message. 
 
 

### FIXED CODE ###



n = int(raw_input())
  
d = [99999 for i in range(n)]
G = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
  
def BFS(s):
    for e in range(n):
        if M[s][e] == 1:
            if d[e] > d[s] + 1:
                d[e] = d[s]+1
                BFS(e)
  
for i in range(n):
    G = map(int, raw_input().split())
    for j in range(G[1]):
        M[G[0]-1][G[2+j]-1] = 1
  
d[0] = 0
for s in range(n):
        BFS(s)
for s in range(n):
    if d[s] == 99999:
        d[s] = -1
for s in range(n):
    print'{0} {1}'.format(s+1, d[s])
import numpy as np
n,m=map(int,input().split())
d=[[]*m for i in range(n)]
l=[]
for i in range(m):
    a,b=map(int,input().split())
    d[a-1].append(b)
    l.append(a)

for i in range(n):
    d[i]=np.argsort(d[i])
    
for i in range(m):
    b=d[l[i]-1].pop(0)
    b+=1
    p=len(list(str(l[i])))
    q=len(list(str(b)))
    ans=''
    for j in range(6-p):
        ans+='0'
    ans+=str(l[i])
    for j in range(6-q):
        ans+='0'
    ans+=str(b)
    print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
l=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append([a,b])
x=sorted(l)
dic={}
x.append([0,0])
f=1
for i in range(m):
    if x[i][0]==x[i+1][0]:
        dic[str(x[i][0])+'000000'+str(x[i][1])]=f
        f+=1
    else:
        dic[str(x[i][0])+'000000'+str(x[i][1])]=f
        f=1
for i in range(m):
    b=dic[str(l[i][0])+'000000'+str(l[i][1])]
    p=len(list(str(l[i][0])))
    q=len(list(str(b)))
    ans=''
    for j in range(6-p):
        ans+='0'
    ans+=str(l[i][0])
    for j in range(6-q):
        ans+='0'
    ans+=str(b)
    print(ans)
A,B=map(int,input().spllit())
if A - B * 2 < 0:
  print(0)
else:
  print(A - B * 2)

### FIXED CODE ###

A,B = map(int,input().split())
ANS = A - B * 2
if ANS <= 0:
  print(0)
else:
  print(ANS)
import math

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

ans = math.ceil((i[0]/ (i[2] + i[1])) ) * i[1]

print (ans)

### FIXED CODE ###

d = list(input())

s = {i for i in d}

if len(s) == 1:
  print ("No")
else :
  print ("Yes")
n=int(input())
if(n%9==0):
  print('Yes')
else print('No')


### FIXED CODE ###

n=int(input())
if(n%9==0):
  print('Yes')
else:
  print('No')
# -*- coding: utf-8 -*-

import sys

def main():
    input = sys.stdin.readline
    n,m = map(int, input().split())
    x_list = list(map(int, input().split()))
    if m == 1:
        print(0)
        exit(0)
    sabun_list = []
    x_list.sort()
    for i,x in  enumerate(x_list):
        if i == 0:
            continue
        sabun_list.append(x - x_list[i-1])
    result = 0
    sum_max_sabun = 0
    for i in range(n-1):
        max_index = sabun_list.index(max(sabun_list))
        sum_max_sabun += sabun_list[max_index]
        sabun_list.pop(max_index)
    
    result = (x_list[-1] - x_list[0]) - sum_max_sabun

    print(result)

    return


if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys

def main():
    input = sys.stdin.readline
    n,m = map(int, input().split())
    x_list = list(map(int, input().split()))
    if n >= m:
        print(0)
        exit(0)
    sabun_list = []
    x_list.sort()
    for i,x in  enumerate(x_list):
        if i == 0:
            continue
        sabun_list.append(x - x_list[i-1])
    result = 0
    sum_max_sabun = 0
    sabun_list.sort(reverse=True)
    sum_max_sabun = sum(sabun_list[:n-1])
    
    result = (x_list[-1] - x_list[0]) - sum_max_sabun

    print(result)

    return


if __name__ == '__main__':
    main()
import heapq
from numpy import sum
N,M = (int(x) for x in input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)
for i in range(M):
    t1 = heapq.heappop(A)
    t2 = t1 // 2
    heapq.heappush(A, t2)
print(int(sum(B)*(-1)))

### FIXED CODE ###

import heapq
from numpy import ceil,sum
N,M = (int(x) for x in input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)
for i in range(M):
    t1 = heapq.heappop(A)
    t2 = t1 / 2
    heapq.heappush(A, t2)
B = ceil(A)
print(int(sum(B)*(-1)))
from itertools import product

N, M, X = map(int, input().split())
inp = [list(map(int, input().split())) for _ in range(N)]

C, A = [], []
for i in range(N):
    C.append(inp[i][0])
    A.append(inp[i][1:])

#判定
z_A = list(zip(*A))
for i in range(N):
    if sum(z_A[i]) < X:
        print(-1)
        exit()

ans = sum(C)

for buy_bit in product(range(2), repeat=N):
    buy = 0
    tmp = 0
    skill = [0] * M
    for i in range(N):
        if buy_bit[i]:
            for j in range(M):
                skill[j] += A[i][j]
            buy += C[i]
    
    f = True
    for s in skill:
        if s < X:
            f = False
            break
    if f:
        ans = min(ans, buy)

print(ans)

### FIXED CODE ###

from itertools import product

N, M, X = map(int, input().split())
inp = [list(map(int, input().split())) for _ in range(N)]

C, A = [], []
for i in range(N):
    C.append(inp[i][0])
    A.append(inp[i][1:])

#判定
z_A = list(zip(*A))
for i in range(M):
    if sum(z_A[i]) < X:
        print(-1)
        exit()

ans = sum(C)

for buy_bit in product(range(2), repeat=N):
    buy = 0
    tmp = 0
    skill = [0] * M
    for i in range(N):
        if buy_bit[i]:
            for j in range(M):
                skill[j] += A[i][j]
            buy += C[i]
    
    f = True
    for s in skill:
        if s < X:
            f = False
            break
    if f:
        ans = min(ans, buy)

print(ans)
if input() == 'AAA' or input() == 'BBB':
  print ("No")
else:
  print("Yes")

### FIXED CODE ###

s = input()
if s == 'AAA' or s == 'BBB':
  print ("No")
else:
  print("Yes")
mountain, answer = [], []

while(True):
  input = raw_input().split()
  if input[0] == 'push':
    mountain.insert(int(input[1]), input[2])
  elif input[0] == 'pop':
    answers.append(input[1])
    mountain.pop(input[1])
  elif input[0] == 'move':
    move_item = mountain[int(input[1])]
    mountain.pop(input[1])
    mountain.insert(int(input[2]), move_item)
  elif input[0] == 'quit':
    break

for answer in answers:
  print answer

### FIXED CODE ###

n = input()
stack = [[] for i in range(n)]
while(True):
    s = raw_input().split()
    if(s[0] == "quit"):
        break
    if(s[0] == "push"):
        stack[int(s[1]) - 1].append(s[2])
    elif(s[0] == "pop"):
        print(stack[int(s[1]) - 1].pop())
    elif(s[0] == "move"):
        stack[int(s[2]) - 1].append(stack[int(s[1]) - 1].pop())
from collections import Counter

n=int(input())
a=list(map(int,input().split()))
a_s=list(set(a))
c_l=Counter(a)

cnt=0
for i in a_s:
    cnt+=c_l[i] if c_l[i]<i else cnt+=c_l[i]-i
print(cnt)

### FIXED CODE ###

a,b=map(int,input().split())
print((a+b)//2 if (a+b)/2 == (a+b)//2 else (a+b)//2+1)
n, q = int(input().split())
#n = 4
#q = 3

ans = [0]*n
ki = {}
for i in range(1,n+1):
    ki[i] = []

#z = ["1 2", "2 3", "2 4"]

for i in range(n-1):
    e = list(map(int, input().split()))
    #e = list(map(int, z[i].split()))
    ki[e[0]].append(e[1])

#print(ki)

def df(graph, start, point):
    stack = [start]
    visited = []
    while stack:
        v = stack.pop(0)
        ans[v - 1] += point
        if v not in visited:
            visited.append(v)
            stack = graph.get(v, []) + stack

#y = ["2 10", "1 100", "3 1"]
for i in range(q):
    p = list(map(int, input().split()))
    #p = list(map(int, y[i].split()))
    df(ki, p[0], p[1])

for n in ans:
    print(n, end=" ")

#v = list(map(int, input().split()))
#n = 3
#v = list(map(int, "500 300 200".split()))
#ans = v[0]
#for i in range(1,n):
#    ans = (v[i] + ans)/2
#print(ans)



### FIXED CODE ###

import sys

def main():
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    n, q = map(int, input().split())
    #n, q = map(int, "4 3".split())
    g = [[] for _ in range(n)]
    for i in range(n-1):
        a, b = map(int, input().split())
        #a, b = map(int, ["1 2", "2 3", "2 4"][i].split())
        g[a-1].append(b-1)
        g[b-1].append(a-1)


    add = [0] * n
    for i in range(q):
        p, v = map(int, input().split())
        #p, v = map(int, ["2 10", "1 100", "3 1"][i].split())
        #dfs(p-1, v)
        add[p-1] += v

    ans = [0] * n
    def dfs(v,p,value): #p: parent of v
        value += add[v]
        ans[v] = value
        for c in g[v]:
            if c == p: continue
            dfs(c,v,value)
    dfs(0, -1, 0)
    """
    def dfs(start, point):
        stack = [start]
        while stack:
            x = stack.pop()
            ans[x] += point
            stack += g[x]
    """

    print(' '.join(map(str, ans)))

if __name__ == '__main__':
    main()
A = input()
B = input()
count = 1

while A < B:
    A += A
    count += 1


print(count)


### FIXED CODE ###

A = input().split()
count = 1
a = int(A[0])
b = int(A[1])
c = a

if b == 1:
    print(0)
else:
    while a < b:
        a += c - 1
        count += 1
        if a > b:
            break
    print(count)
N = int(input())
X_bin = input()

X_int = int(X_bin, 2)  # bin => int
dp = {1: 1}
bin_cnt = {}


def calc_bin_cnt(next_int):
    if next_int in bin_cnt.keys():
        cnt = bin_cnt[next_int]
    else:
        next_bin = format(next_int, 'b')
        # popcount
        cnt = 0
        for i in next_bin:
            if i == '1':
                cnt += 1
        bin_cnt[next_int] = cnt
    return cnt


def calc_ans(next_int):
    key = next_int
    if key in dp.keys():
        ans = dp[key]
    else:
        '''
        next_bin = format(next_int, 'b')
        # popcount
        cnt = 0
        for i in next_bin:
            if i == '1':
                cnt += 1
        '''
        cnt = calc_bin_cnt(next_int)
        bin_cnt[next_int] = cnt
        next_int = next_int % cnt
        if next_int > 0:
            ans = calc_ans(next_int) + 1
        else:
            ans = 1
        dp[key] = ans
    return ans


for i in range(N):
    if X_bin[i] == '1':
        print(calc_ans(X_int - (2**(N-i-1))))
    else:
        print(calc_ans(X_int + (2**(N-i-1))))


### FIXED CODE ###

N = int(input())
X_bin = input()
#N = 10**5
#X_bin = '1' * N

X_int = int(X_bin, 2)  # bin => int


def calc_bin_cnt(next_int):
    if next_int == 0:
        return 0
    next_bin = bin(next_int)[2:]
    # popcount
    cnt = 0
    for i in next_bin:
        if i == '1':
            cnt += 1
    return cnt


def calc_ans(next_int, cnt=None):
    if next_cnt == 0:
        return 0
    if next_int == 0:
        return 1
    if cnt is None:
        cnt = calc_bin_cnt(next_int)
    next_int = next_int % cnt
    if next_int > 0:
        ans = calc_ans(next_int) + 1
    else:
        ans = 1
    return ans


X_cnt = calc_bin_cnt(X_int)
f_p = X_int % (X_cnt+1)
if X_cnt-1 == 0:
    f_m = 0
else:
    f_m = X_int % (X_cnt-1)
for i in range(N):
    if X_bin[i] == '1':
        next_cnt = X_cnt - 1
        if next_cnt == 0:
            next_int = 0
        else:
            next_int = f_m - pow(2, (N-i-1), next_cnt)  # マイナスでも正しく求まる？
    else:
        next_cnt = X_cnt + 1
        next_int = f_p + pow(2, (N-i-1), next_cnt)
    print(calc_ans(next_int, next_cnt))
    #calc_ans(next_cnt, next_cnt)
pi = math.pi
r = float(input())
print("{:.010f}{;.010f}".format(r**2*pi,2*r*pi))


### FIXED CODE ###

from math import pi
r = float(input())
print("{:.010f} {:.010f}".format(r * r * pi, 2 * pi * r))
a,b=map(int,input().split())
if a*b%2=0:
  print("Even")
else:
  print("Odd")


### FIXED CODE ###

a,b=map(int,input().split())
if (a*b)%2==0:
  print("Even")
else:
  print("Odd")
N=input()

if 7 in N:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N=list(map(int,input()))

if 7 in N:
  print("Yes")
else:
  print("No")
import math
a = 0
X = int(input())
[N,D] = X.split(' ')
for n in range(N):
  Y = int(input())
  [xn,yn] = Y.split(' ')
  qn = math.sqrt(xn ** 2 + yn ** 2)
  if qn <= D:
    a += 1
print(a)
  


### FIXED CODE ###

import math
n,d = map(int,input().split())
r = 0
d_ = d**2
for i in range(n):
  a,b = map(int,input().split())
  if d_ >= a**2 + b**2:
    r += 1
print(r)
S1 = input()
S2 = input()
if S1.reverse == S2:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

S1 = input()
S2 = input()
if S1[::-1] == S2:
  print("YES")
else:
  print("NO")
n, q = map(int, input().split())

trees = [[] for i in range(n)]

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

#print("trees: ", trees)    
    
values = [0 for i in range(n)]
for i in range(q):
    p, x = map(int, input().split())
    values[p-1] += x

#print("values: ", values)

def dfs(i):
    for j in trees[i]:
        values[j] += values[i]
        #print("values",i , j, values)
        dfs(j)

dfs(0)
print(*values)

### FIXED CODE ###

n,q=map(int,input().split())
T=[[] for _ in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
C=[0]*n
for i in range(q):
    p,x=map(int,input().split())
    C[p-1]+=x
S=[0]
P=[0]*n
while S:
    s=S.pop()
    for t in T[s]:
        if t==P[s]:
            continue
        P[t]=s
        S.append(t)
        C[t]+=C[s]
print(' '.join(map(str,C)))
s=input()
if len(s)==26:
	d=[]
	for i in range(26):
		if list(s[-i-1:][::-1])!=sorted(s[-i-1:]):
			for j in range(i+1):
				d.append(s[-j-1])
			d.sort()
			if d[0]==s[-i-1]:
				k=d[1]
			else:
				k=d[0]
				print(2/0)
			print(s[:-i-1]+k)
			exit()
	print(-1)
	exit()
d=[0]*26
for i in range(len(s)):
	d[ord(s[i])-ord("a")]+=1
for i in range(26):
	if d[i]==0:
		x=chr(ord("a")+i)
		break
print(s+x)

### FIXED CODE ###

s=input()
if len(s)==26:
	d=[]
	for i in range(26):
		if list(s[-i-1:][::-1])!=sorted(s[-i-1:]):
			for j in range(i+1):
				d.append(s[-j-1])
			d.sort()
			if d[0]==s[-i-1]:
				k=d[1]
			else:
				for j in range(len(d)):
					if d[j]>s[-i-1]:
						k=d[j]
						break
			print(s[:-i-1]+k)
			exit()
	print(-1)
	exit()
d=[0]*26
for i in range(len(s)):
	d[ord(s[i])-ord("a")]+=1
for i in range(26):
	if d[i]==0:
		x=chr(ord("a")+i)
		break
print(s+x)
import collections
N = int(input())
A = list(map(int,input().split()))
CA = collections.Counter(A)
S = 0
for i in CA.values():
    S += i*(i-1)//2
for x in range(A):
    print(S - count[x] + 1)

### FIXED CODE ###

import collections
N = int(input())
A = list(map(int,input().split()))
CA = collections.Counter(A)
S = 0
for i in CA.values():
    S += i*(i-1)//2
for x in A:
    print(S - CA[x] + 1)