Harryxun/stf_run huggingface dataset:
data = input().split()
a = int(data[0])
b = int(data[1])
while(a != 0 and b != 0):
	if a > b:
		temp = a
		a = b
		b = temp
	print(str(b) + " " + str(a))
	data = input().split()
	a = int(data[0])
	b = int(data[1])
	

### FIXED CODE ###

data = input().split()
a = int(data[0])
b = int(data[1])
while(a != 0 or b != 0):
	if a > b:
		temp = a
		a = b
		b = temp
	print(str(a) + " " + str(b))
	data = input().split()
	a = int(data[0])
	b = int(data[1])
N = int(input())
a = list(map(int,input().split()))
buka_num=[0 for _ in range(N+1)]

for i in a:
  buka_num[i]+=1
buka_num.pop(0)
for j in buka_num:
  print(j)

### FIXED CODE ###

R = int(input())
print(R*2*3.1415)
import sys

X,N = map(int,input().split())
P = list(map(int,input().split()))
if X < 1 or 100 < X:
    sys.exit()
if N < 0 or 100 < N:
    sys.exit()

P_number = len(P)
if P_number < 1 or 100 < P_number:
    sys.exit()

res = [100,100]
i = 0
while i < N:
    if res[0] >= abs(X - P[i]) and res[1] > P[i]:
        res[0] = abs(X - P[i])
        res[1] = P[i]
    i += 1
print(res[1])

### FIXED CODE ###

X = list(map(int, input().split()))
count = 1
for I in X:
  if I == 0:
    print(count)
    exit
  count += 1
count=0
d=0
i=0
while d<=x:
    if i==0:
        d=0
        if d<=x:
            count=1
        i+=1
    elif count<=n+1:
        d=d+int(a[i-1])
        if d<=x:
            count+=1
            i+=1
    else:
        break;
print(count)

### FIXED CODE ###

n,x=map(int,input().split())
a=list(input().split())
count=0
d=0
i=0

while d<=x:
    if i==0:
        d=0
        count=1
        i+=1
    elif count<=n+1 and i<n+1:
        d=d+int(a[i-1])
        if d<=x:
            count+=1
            i+=1
        else:
            break;
    else:  
        break;
print(count)
from itertools import accumulate
from math import log2

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

for j in range(k):
    a01 = [0] * (n + 1)
    for i, ai in enumerate(a):
        l, r = max(0, i - ai), min(i + ai + 1, n)
        a01[l] += 1
        a01[r] -= 1
    a = list(accumulate(a01))
    if all(ai == n for ai in ai[:-1]):
        break
print(*a[:-1])


### FIXED CODE ###

from itertools import accumulate
from math import log2

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

for j in range(k):
    a01 = [0] * (n + 1)
    for i, ai in enumerate(a):
        l, r = max(0, i - ai), min(i + ai + 1, n)
        a01[l] += 1
        a01[r] -= 1
    a = list(accumulate(a01))
    if all(ai == n for ai in a[:-1]):
        break
print(*a[:-1])
N,M,C=map(int,input().split()) 
B=list(map(int,input().split()))
A =[list(map(int,input().split()))for i in range(N)]
ans=0
for i in range(N):
    X=0
    for j in range(M):
        X+=(A[i][j]*B[j])
    X=X+C
    if  0 < X:
        ans = ans+1
print(ans)
    


### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())
B=(H-h)*(W-w)
print(B)
X,Y = map(int,input().split())
dp = [[0]*(X+1) for _ in range(Y+1)]
mod = 10**9+7

dp[0][0] = 1
dp[0][1] = 0
dp[1][0] = 0
dp[1][1] = 0
for j in range(1,Y+1):
    for i in range(1,X+1):
        dp[j][i]=(dp[j-1][i-2]+dp[j-2][i-1])%mod
print(dp[-1][-1])

### FIXED CODE ###

X,Y = map(int,input().split())
# 何回移動するか
r = (X+Y)//3
# 移動の可能性 rC(x-r)
from functools import reduce
mod = 10**9+7

if (X+Y)%3==0 and X<= 2*Y and Y<= 2*X :
    r = (X+Y)//3
    l = min
    if r != X and r != Y:
        num = reduce(lambda x,y:x*y%mod,[k+1 for k in range(r)])
        p = reduce(lambda x,y:x*y%mod,[k+1 for k in range(X-r)])
        q = reduce(lambda x,y:x*y%mod,[k+1 for k in range(2*r-X)])
        ans = num*pow(p,mod-2,mod)*pow(q,mod-2,mod)%mod
        print(ans%mod)   
    else:
        print(1)
else:
    print(0)
print(sum(list(range(1, int(input()+1)))))

### FIXED CODE ###

N = int(input())
sum = 0
for i in range(1, N+1):
    sum += i
print(sum)
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if i*500+n*100+m*50==X:
                count += 1
print(count)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a*500+b*100+c*50==X:
                count += 1
print(count)
a,b,c,b = map(int,input().split())
print( max(a*b, c*d) )


### FIXED CODE ###

a,b,c,d = map(int,input().split())
print( max(a*b, c*d) )
import math
a,b,c,d = map(int,input().split())
t1 = b//c-a//c
if a%c == 0:
    t1 += 1
t2 = b//d-a//d
if a%d == 0:
    t2 += 1
lcm = c*d//math.gcd(c,d)
t3 = b//lcm-a//lcm
if a%lcm == 0:
    t3 += 1
print(b-a+1-(t1+t2-t3))

### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
t1 = b//c-a//c
if a%c == 0:
    t1 += 1
t2 = b//d-a//d
if a%d == 0:
    t2 += 1
lcm = c*d//fractions.gcd(c,d)
t3 = b//lcm-a//lcm
if a%lcm == 0:
    t3 += 1
print(b-a+1-(t1+t2-t3))
N, A, B = map(int, input().split())
S = ''
#print('N:{}'.format(N), 'A:{}'.format(A), 'B:{}'.format(B))

for i in range((N//(A+B))+1):
    S += 'b'*A
    S += 'r'*B
print(S[:N].count('b'))

### FIXED CODE ###

N, A, B = list(map(int, input().split()))
#print('N:{}'.format(N), 'A:{}'.format(A), 'B:{}'.format(B))
#print(A*(N//(A+B)), min(A, N%(A+B)))
print(A*(N//(A+B)) + min(A, N%(A+B)))
N = int(input())
A = int(input())
B = int(input())
#print(A+B)
 
b_count = 0
for i in range(0, N):
  #print('i')
  #print(i)
  if i % (A+B) < A:
    #print(b_count)
    b_count = b_count + 1
print(b_count)

### FIXED CODE ###

S = input()
N = int(S.split(' ')[0])
A = int(S.split(' ')[1])
B = int(S.split(' ')[2])
 
b_count = (N // (A+B)) * A
rem = N % (A+B)
b_count = b_count + min(rem, A)
print(b_count)
import math
N = int(input())
num = list(map(int, input().split()))

MAXX = 10**6 + 1
MAXZ = int(math.sqrt(MAXX)+1)
furui = [[] for _ in range(MAXZ)]

furui[1].append(1)
count = [0]*MAXX
for i in range(2, MAXZ):
    if len(furui[i]) == 0:
        for k in range(i, MAXZ, i):
            furui[k].append(i)

setwise = True
pairwise = True
for i in range(N):
    if not setwise and not pairwise: break
    for fu in furui[num[i]]:
        count[fu] += 1
        if count[fu] >= N:
            setwise = False
            pairwise = False
            break
        elif count[fu] > 1:
            pairwise = False

if pairwise:
    print('pairwise coprime')
elif setwise:
    print('setwise coprime')
else:
    print('not coprime')


### FIXED CODE ###

import math
N = int(input())
num = list(map(int, input().split()))
#N = 10**6
#num = list(range(1, N+1))

MAXX = 10**6 + 1
MAXZ = int(math.sqrt(MAXX)+2)
furui = [[] for _ in range(MAXX)]

furui[1].append(1)
count = [0]*MAXX
for i in range(2, MAXX):
    if len(furui[i]) == 0:
        for k in range(i, MAXX, i):
            furui[k].append(i)

setwise = True
pairwise = True
for i in range(N):
    if not setwise and not pairwise: break
    for fu in furui[num[i]]:
        count[fu] += 1
        if fu > 1 and count[fu] >= N:
            setwise = False
            pairwise = False
            break
        elif fu > 1 and count[fu] > 1:
            pairwise = False

if pairwise:
    print('pairwise coprime')
elif setwise:
    print('setwise coprime')
else:
    print('not coprime')
n=int(input())
a=list(map(int,input().split()))
count=1
if 0 in a:
  print(0)
  exit()
for i in a:
    count*=i
	if count>10**18:
    	print(-1)
        exit()
print(count)


### FIXED CODE ###

n = int(input())
lis = list(map(int,input().split()))
ans = 1
if 0 in lis:
  print(0)
  exit()
for num in lis:
  ans *= num
  if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)
H,W,M=map(int,input().split())
countH=[0]*(H+1)
countW=[0]*(W+1)
S=[[0]*(W+1)for _ in range(H+1)]
hw=[[0,0]for _ in range(M)]
i=0
for _ in range(M):
    h,w=map(int,input().split())
    countH[h]+=1
    countW[w]+=1
    hw[i]=[h,w]
    S[h][w]=1

hw.sort()
mh=max(countH)
mw=max(countW)
ans=mh+mw-1

c_mh=[]
i=0
while i<=H:
    if countH[i]==mh:
        c_mh.append(i)
    i+=1

c_mw=[]
i=0
while i<=W:
    if countW[i]==mw:
        c_mw.append(i)
    i+=1

ok=0
for h in c_mh:
    for w in c_mw:
        if S[h][w]==0:
            ans+=1
            ok=1
        if ok:
            break
    if ok:
        break

print(ans)

### FIXED CODE ###

H,W,M=map(int,input().split())
countH=[0]*(H+1)
countW=[0]*(W+1)
S={}
i=0
for _ in range(M):
    h,w=map(int,input().split())
    countH[h]+=1
    countW[w]+=1
    S[str(h)+','+str(w)]=1

mh=max(countH)
mw=max(countW)
ans=mh+mw-1

c_mh=[]
i=0
while i<=H:
    if countH[i]==mh:
        c_mh.append(i)
    i+=1

c_mw=[]
i=0
while i<=W:
    if countW[i]==mw:
        c_mw.append(i)
    i+=1

ok=0
ok1=0
ok2=0
for h in c_mh:
    for w in c_mw:
        S.setdefault(str(h)+','+str(w))
        if S[str(h)+','+str(w)]==1:
            continue
        else:
            ans+=1
            ok=1
        if ok:
            break
    if ok:
        break

print(ans)
import math

N = int(input())
A = [int(a) for a in input().split(" ")]

firstgcds = [0]
lastgcds = [0]
for i in range(0, N):
    firstgcds.append(math.gcd(firstgcds[i], A[i]))
    lastgcds.append(math.gcd(lastgcds[i], A[-i-1]))
ans = 0
for i in range(0, N):
    preans = math.gcd(firstgcds[i], lastgcds[-i-2])
    if ans < preans:
        ans = preans
if ans < firstgcds[N-1]:
    ans = firstgcds[N-1]
print(ans)


### FIXED CODE ###

import fractions

N = int(input())
A = [int(a) for a in input().split(" ")]

firstgcds = [0]
lastgcds = [0]
for i in range(0, N):
    firstgcds.append(fractions.gcd(firstgcds[i], A[i]))
    lastgcds.append(fractions.gcd(lastgcds[i], A[-i-1]))
ans = 0
for i in range(0, N):
    preans = fractions.gcd(firstgcds[i], lastgcds[-i-2])
    if ans < preans:
        ans = preans
if ans < firstgcds[N-1]:
    ans = firstgcds[N-1]
print(ans)
n = int(input())
if n%10**3 != 0:
  return 1000 - n%10**3
else:
  return 0

### FIXED CODE ###

n = int(input())
if n%1000 != 0:
    print(1000 - n%1000)
else:
    print(0)
S=input()
if S='ABC':
  print('ARC')
else:
  print('ABC')

### FIXED CODE ###

S=input()
if S=='ABC':
  print('ARC')
else:
  print('ABC')
a,b= map(int,input().split())

if a > 8 or b > 8:
    print(":(")
else:
    priunt("Yay!")

### FIXED CODE ###

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

if a > 8 or b > 8:
    print(":(")
else:
    print("Yay!")
A,B,C,D,E,F = map(int, input().split())

val_max = 0
for a in range(0,1+F//(100*A)):
  for b in range(0,1+(F-100*A*a)//(100*B)):
    for c in range(0,1+(F-100*A*a-100*B*b)//C):
      for d in range(0,1+(F-100*A*a-100*B*b-C*c)//D):
        if C*c+D*d <= E*(A*a+B*b):
          val = (C*c+D*d)/(100*A*a+100*B*b+C*c+D*d)
          if val > val_max:
            val_max = val
            ans1 = 100*A*a+100*B*b+C*c+D*d
            ans2 = C*c+D*d
print(ans1,ans2)

### FIXED CODE ###

A,B,C,D,E,F = map(int, input().split())

val_max = 0
for a in range(0,1+F//(100*A)):
  for b in range(0,1+(F - 100*A*a)//(100*B)):
    if (a==0)&(b==0):
      continue
    for c in range(0,1+(F - 100*A*a - 100*B*b)//C):
      for d in range(0,1+(F - 100*A*a - 100*B*b - C*c)//D):
        if C*c+D*d <= E*(A*a+B*b):
          val = (C*c + D*d)/(100*A*a + 100*B*b + C*c + D*d)
          if val >= val_max:
            val_max = val
            ans1 = 100*A*a + 100*B*b + C*c + D*d
            ans2 = C*c + D*d
print(int(ans1),int(ans2))
def framod(n,mod):
    a=1
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n,r,mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod
    
def comb(n,k,mod):
    if n<0 or k<0 or n<k: return 0
    if n==0 or k==0: return 1
    a=framod(n,mod)
    b=framod(k,mod)
    c=framod(n-k,mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

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

pf={}
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
    
mblist=list()
for i in pf:
    a = comb(pf[i]+n-1,pf[i],mod)
    mblist.append(a)
ans=1
for i in mblist:
    ans=(ans*i)%mod
print(ans)

### FIXED CODE ###

from collections import Counter
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5+1000
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n,m=map(int, input().split())
mb=[]
while m>1:
    for i in range(2,int(m**0.5)+1):
        if m%i==0:
            mb.append(i)
            m//=i
            break
    else:
        mb.append(m)
        m//=m
mb2=Counter(mb)
    
mblist=list()
for i in mb2:
    a = cmb(mb2[i]+n-1,mb2[i],mod)
    mblist.append(a)
ans=1
for i in mblist:
    ans=(ans*i)%mod
print(ans)
n=int(input().split())
dic=set()
dic|={n}
i=1
while True:
  if n%2==0:
    n=n//2
  else:
    n=3*n+1
  i+=1
  if n in dic:
    print(i)
    break
  else:
    dic|={n}


### FIXED CODE ###

s = int(input())

used = set()
used |= {s}
count = 1

while True:
    if s % 2 == 0: s//=2
    else:s=3*s+1
    if s in used:
        print(count+1)
        break
    else:
        used |= {s}
        count += 1
x = int(input())

my_dict = dict()

for i in range(10 ** 6):
    my_dict[i**5] = i

for i in range(-10**2, 10 ** 2):
    target = x + (i ** 5)
    if (- target) in my_dict:
        print(-my_dict[target], i)
        exit()
    elif target in my_dict:
        print(my_dict[target], i)
        exit()


### FIXED CODE ###

x = int(input())

my_dict = dict()

for i in range(1000):
    my_dict[i**5] = i

for i in range(-1000, 1000):
    target = x + (i ** 5)
    if (- target) in my_dict:
        print(-my_dict[-target], i)
        exit()
    elif target in my_dict:
        print(my_dict[target], i)
        exit()
n,m=map(int,input().split())
a,b=n//2,n//2+1
for i in range(m):
    print(i+1,2*m-i+(n%2==0 and 2*(m-i)>=n//2)

### FIXED CODE ###

n,m=map(int,input().split())
for i in range(m):
    print(i+1,2*m-i+(n%2==0 and 2*(m-i)-1>=n//2))
n=int(input())
s=list(input())
x=[]
y=[]

for i in range(n):
  if s[i]=='R':
    x+=[i]
  elif s[i]=='W':
    y+=[i]
    
ans=0

while True:
    if len(y)==0:
      print(ans)
      break
    elif x[-1]>y[0]:
      x.pop()
      y.pop(0)
      ans+=1
      continue
    
    else:
      print(ans)
      break

### FIXED CODE ###

n=int(input())
s=list(input())
x=[]
y=[]

for i in range(n):
  if s[i]=='R':
    x+=[i]
  elif s[i]=='W':
    y+=[i]
    
ans=0


while True:
    if len(y)==0:
      print(ans)
      break
    elif len(x)==0:
      print(ans)
      break
    elif x[-1]>y[0]:
      x.pop()
      y.pop(0)
      ans+=1
      continue
    
    else:
      print(ans)
      break
N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
mod=10**9+7
fan=[1]*N+1
for i in range(2,N+1):
  fan[i]=fan[i-1]*(i)%mod
ans=0
def comb(a,b):
  return fan[a]*pow(fan[b],mod-2,mod)*pow(fan[a-b],mod-2,mod)%mod
for i in range(N-K+1):
  for j in range(0,i-K+1)
  ans+=comb(i-j-1,K-1)*(A[N-1-i]-A[j])
  ans%=mod
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
mod=10**9+7
fan=[1]*(N+1)
for i in range(2,N):
  fan[i]=fan[i-1]*(i)%mod
ans=0
def comb(a,b):
  return fan[a]*pow(fan[b],mod-2,mod)*pow(fan[a-b],mod-2,mod)
for i in range(N-K+1):
  ans+=comb(N-i-1,K-1)*(A[N-i-1]-A[i])
  ans%=mod
print(ans)
## C
N, M = map( int, input().split() )
H = [0] + list(map(int, input().split()) )
X = [[] for x in range(N+1)]
for i in range(M):
    A, B = map(int, input().split())
    X[A].append(H[B])
    X[B].append(H[A])
rt = 0
for i in range(1, N+1):
    if H[i] > max(X[i]):
        rt += 1
print(rt)

### FIXED CODE ###

N, M = map( int, input().split() )
H = list(map(int, input().split()) )
flg = [1] * N
for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    if H[A] > H[B]:
        flg[B] = 0
    elif H[A] < H[B]:
        flg[A] = 0
    elif H[A] == H[B]:
        flg[A] = 0
        flg[B] = 0
print(sum(flg))
n = int(input())
s=list(str,input())
count = 0
for s in range(10) 
    for i in range(n):
        if type(s[i]/2) ==True :
            s[i]=s[i]/2
            i = i+1
        count +=1
        elif type(s[i]/2) ==False:
        break
break
print(count)

### FIXED CODE ###

def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans
 
n = int(input())
a = map(int,input().split())
ans = min(map(how_many_times_divisible, a))
 
print (ans)
K=int(input())

L=9*K/7 if K%7==0 else 9*K

if L%2==0 or L%5==0:
    print('-1')

else:
    surplus=1
    for i in range(1,L):
        surplus=(surplus*10)%L
        if surplus==1:
            print(i)
            break
    print('-1')

### FIXED CODE ###

K=int(input())

L=9*K//7 if K%7==0 else 9*K

if L%2==0 or L%5==0:
    print('-1')

else:
    surplus=1
    for i in range(1,L):
        surplus=(surplus*10)%L
        if surplus==1:
            print(i)
            break
# https://atcoder.jp/contests/diverta2019-2/tasks/diverta2019_2_b
# 問題文はよく読もうね！

# 実際にボールを拾っていくシミュレーションをしていっても十分間に合う

from itertools import combinations
from collections import defaultdict
from operator import itemgetter

N = int(input())
points = [tuple(map(int, input().split())) for _ in range(N)]
ans = 0


def is_online(x0, y0, xa, ya, p, q):
    # x0,y0を通る直線がp,qで与えられたときに、xa,yaがその線上にあるか判別
    dx = xa - x0
    dy = ya - y0
    if dx == 0 and dy == 0:
        return True
    elif dx == 0 or dy == 0:
        return False
    # print(x0, y0, xa, ya, p, q)
    return (dy / dx) == (q / p)  # 傾きが同じならば線上にある


def pickballs(balls):
    # cnt most frequent p,q
    global ans

    # 最適なpq探索
    cnts = defaultdict(lambda: 0)
    for pa, pb in combinations(balls, 2):
        dx = pa[0] - pb[0]
        dy = pa[1] - pb[1]
        if dx == 0 or dy == 0:
            continue
        if dx < 0:
            dx *= -1
            dy *= -1
        cnts[(dx, dy)] += 1
    p, q = max(cnts.items(), key=itemgetter(1))[0]

    # 最適な最初のpickball探索
    cnts = defaultdict(lambda: 0)
    for p0 in balls:
        for p1 in balls:
            if p0 == p1:
                continue
            if is_online(p0[0], p0[1], p1[0], p1[1], p, q):
                cnts[p0] += 1
    x, y = max(cnts.items(), key=itemgetter(1))[0]

    # 実際にpickball
    ans += 1
    ret = []
    for p1 in balls:
        if is_online(x, y, p1[0], p1[1], p, q):
            continue
        ret.append(p1)
    return ret


while points:
    points = pickballs(points)
print(ans)


### FIXED CODE ###

# https://atcoder.jp/contests/diverta2019-2/tasks/diverta2019_2_b


from itertools import combinations
from collections import defaultdict

N = int(input())
points = [tuple(map(int, input().split())) for _ in range(N)]

if N == 1:
    print(1)
    exit()

# points.sort()  # 先にソートしておくと大小関係の処理が楽

cnts = defaultdict(lambda: 0)
for pa, pb in combinations(points, 2):
    dx = pa[0] - pb[0]
    dy = pa[1] - pb[1]
    if dx < 0:  # 事前にソートしておくとココらへんの処理がいらなくなるよ
        dx *= -1
        dy *= -1
    if dx == 0:
        dy = max(dy, -dy)
    if dy == 0:
        dx = max(dx, -dx)
    cnts[(dx, dy)] += 1

print(N - max(cnts.values()))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 15 16:58:00 2019

@author: YudNK
"""
#import heapq as hp
#import bisect as bs

N, Q = map(int, input().split())
E = []
for i in range(N):
    s, t, x = map(int, input().split())
    app = [s - x, -1, x] #追加イベント
    rem = [t - x, -2, x] #削除イベント
    E.append(app)
    E.append(rem)
for i in range(Q):
    d = [int(input()), i, -1]
    E.append(d)
E.sort(key = lambda x:x[0])

ans = []
stopX = []

for e in E:
    if e[1] == -1:
        stopX.heappush(e[2])
    elif e[1] == -2:
        stopX.remove(e[2])
    else:
        if len(stopX) != 0:
            ans.append(stopX[0])
        else:
            ans.append(-1)
[print(i) for i in ans]

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 15 16:58:00 2019

@author: YudNK
"""
import bisect as bs

N, Q = map(int, input().split())
E = []
for i in range(N):
    s, t, x = map(int, input().split())
    a = [s - x, t - x, x] #イベント
    E.append(a)
E.sort(key = lambda x: x[2])
D = []
for i in range(Q):
    D.append(int(input()))

ans = [-1]*Q
check = [-1]*Q

for e in E:
    l = bs.bisect_left(D, e[0])
    r = bs.bisect_left(D, e[1])
    while l < r:
        if check[l] == -1:  
            ans[l] = e[2]
            check[l] = r
            l += 1
        else:
            l = check[l]
        
[print(i) for i in ans]
import sys

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

if k==0:
    print(sum(a))
    sys.exit()
    
kk=[]
kkk=k
kcnt=0
while kkk>0:
    kk.append(kkk%2)
    kcnt+=1
    kkk=kkk//2
#print(kcnt)    
    
f=[0]*kcnt
for ai in a:
    icnt=0
    while ai>0:
        f[icnt]+=ai%2
        ai=ai//2
        icnt+=1

n2=n//2
smax=0
idx=1
for i in range(len(f)):
    if f[i]>n2:
        smax+=idx*f[i]
    else:
        smax+=idx*(n-f[i])
    idx*=2

print(smax)        

### FIXED CODE ###

import sys

icase=0
if icase==0:
    n,k=map(int,input().split())
    a=list(map(int,input().split()))
elif icase==1:
    n,k=4,9
    a=[7,4,0,3]
elif icase==2:
    n,k=3,7
    a=[1,6,3]
elif icase==3:
    n,k=1,0
    a=[1000000000000]

if k==0:
    print(sum(a))
    sys.exit()
    
kk=[0]*42
kkk=k
kcnt=0
while kkk>0:
    kk[kcnt]=kkk%2
    kcnt+=1
    kkk=kkk//2
    
f=[0]*42
for ai in a:
    icnt=0
    while ai>0:
        f[icnt]+=ai%2
        ai=ai//2
        icnt+=1

n2=n//2+1
fm=[0]*42

flg1=0
flg2=0
for i in range(41,-1,-1):
    if flg1==0 and kk[i]==0:
        fm[i]=0
    if flg1==0 and kk[i]==1:
        flg1=1
    if flg1==0:
        fm[i]=f[i]        
        continue
#  case : flg1=1
    if kk[i]==1 and f[i]>=n2 and flg2==0:
        flg2=1
    if kk[i]==1 or (kk[i]==0 and flg2==1):
        if f[i]<n2:
            fm[i]=n-f[i]
        else:
            fm[i]=f[i]        
    else:
        fm[i]=f[i]        
    
smax=0
idx=1
for i in range(len(fm)):
    smax+=idx*fm[i]
    idx*=2

print(smax)
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
q = lmiinps()

k = 1
l = 0
s = 0

a = sorted(q)
a.append(0)

b = [0]*(a[n-1])
d = [0]*(a[n-1])

def re(n):
  if n < 2:
    return 1
  return n*re(n-1)

def c(n):
  return re(n)//re(n-2)//2

for i in range(n):
    if a[i] == a[i+1]:
        k += 1
    else:
        l = c(k)
        s += l
        b[a[i]-1]=l
        d[a[i]-1]=k
        k = 1

for j in q:
    if d[j-1] == 0:
        continue
    p = s-((b[j-1])-((b[j-1] *(d[j-1]-2)) // d[j-1]))
    print(p)

### FIXED CODE ###

def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
q = lmiinps()

k = 1
l = 0
s = 0

a = sorted(q)
a.append(0)

b = [0]*(a[n-1])
d = [0]*(a[n-1])

for i in range(n):
    if a[i] == a[i+1]:
        k += 1
    else:
        l = ((k*(k-1))//2)
        s += l
        b[a[i]-1]=l
        d[a[i]-1]=k
        k = 1

for j in q:
    p = s-((b[j-1])-((b[j-1] *(d[j-1]-2)) // d[j-1]))
    print(p)
h,w = list(map(int,input().split())
h1,w1 = list(map(int,input().split())

print((h-h1)*(w-w1))


### FIXED CODE ###

h,w = list(map(int,input().split()))
h1,w1 = list(map(int,input().split()))

print((h-h1)*(w-w1))
r = input()
r = int(r)
pi = 3.14159265
print("{0:6f} {1:6f}".format(r * r * pi, 2 * r * pi))

### FIXED CODE ###

r = input()
r = float(r)
pi = 3.14159265358979
print("{0:10f} {1:10f}".format((r ** 2 * pi), (2 * r * pi)))