Harryxun/stf_run huggingface dataset:
N=int(input())
A=[int(a) for a in input().split()]
Acnt=[A.count(n) for n in range(N)]
Aprob=[Acnt[n]*(Acnt[n]-1)//2 for n in range(N)]
sumA=sum(Aprob)  

for a in A:
  """
  ai=[]
  ai=A[:n]+A[n+1:]
  #print(ai)
  Adic[A[n]]-=1
  ans=0
  for i,v in Adic.items():
    ans+=v*(v-1)//2
  """
  ans=(Acnt[a]-1)*(Acnt[a]-2)//2
  print(ans+sumA-Aprob[a])
  
  



### FIXED CODE ###

def main():
  N=int(input())
  A=[int(a) for a in input().split()]
  Acnt, Aprob={}, {}
  for a in A:
    Acnt[a] = Acnt.get(a, 0) + 1
  sumA=0
  for k, a in Acnt.items():
    Aprob[k]=a*(a-1)//2
    sumA+=Aprob[k]
  #Acnt=[A.count(n) for n in range(N+1)]
  #Aprob=[Acnt[n]*(Acnt[n]-1)//2 for n in range(N+1)]
  #sumA=sum(Aprob)

  for a in A:
    ans=(Acnt[a]-1)*(Acnt[a]-2)//2
    print(ans+sumA-Aprob[a])
  
main()
s = input()
week = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
i = 0
for num,day in enumerate(weeK):
  if s == day:
    i = 7 - num
print(i)

### FIXED CODE ###

s = input()
a = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
i = 0
for num,day in enumerate(a):
  if s == day:
    i = 7 - num

print(i)
intl=map(int, raw_input().split)

a=intl[0]
b=intl[1]

if a==b:
  print "a == b"
elif a>b:
  print "a > b"
else:
  print "a < b"

### FIXED CODE ###

intl=map(int, raw_input().split())

a=intl[0]
b=intl[1]

if a==b:
  print "a == b"
elif a>b:
  print "a > b"
else:
  print "a < b"
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % 5
        if V == 0:
            break

    if cnt<=N:
        flag = False
        print(1)
    
    return flag

X = int(input())

flag = True
N = X//100
V = X-N*100

while flag:
    if N > V/5:
        flag = fun(N,V)
        N -= 1
        V += 100
    else:
        flag = False
        
        print(0)

### FIXED CODE ###

def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % (5-i)
        if V == 0:
            break

    if cnt<=N and V==0:
        flag = False
        print(1)
    else:
        flag = True
    
    return flag

def main():
    X = int(input())

    flag = True
    N = X//100
    V = X-N*100

    while flag:
        if N >= V/5:
            flag = fun(N,V)
            N -= 1
            V += 100
        else:
            flag = False
            print(0)

if __name__=='__main__':
    main()
import math

A, B = map(int, input().split())
d = math.gcd(A, B)
#print('d={}'.format(d))

# make a prime list
# nまでの自然数が素数かどうかを表すリストを返す、エラストテネスの篩 O(nloglogn)
def make_prime_checker(n):
    is_prime = [False, True, False, False, False, True] * (n//6+1)
    del is_prime[n+1:]
    is_prime[1:4] = False, True, True
    for i in range(5, int(n**0.5)+1):
        if is_prime[i]:
            is_prime[i*i::i] = [False] * (n//i-i+1)
    return is_prime
 
primes = [p for p, is_prime in enumerate(make_prime_checker(10**6)) if is_prime]
 
ans = 1
for p in primes:
    if d % p == 0:
        ans += 1
        #print('p={}'.format(p))
    elif p > d:
        print(ans)
        exit()


### FIXED CODE ###

import fractions

# divisor
def div(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors

def factor(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr

def main():
    A, B = map(int, input().split())
    d = fractions.gcd(A, B)
    #print('d={}'.format(d))

    if d == 1:
        print(1)
    else:
        print(1 + len(factor(d)))

if __name__ == '__main__':
    main()
N = int(input())
listh = list(map(int, input().split()))
listans = [listh[0]]
for n in range(1,N-1):
    if (listh[n+1]-listh[n])*(listh[n]-listh[n-1])<=0:
        listans.append(listh[n])
listans.append(listh[N-1])        
#print(listans)
l =len(listans)
listans2 = []
for n in range(l-1):
    if listans[n] == listans[n+1]:
        pass
    else:
        listans2.append(listans[n])
listans2.append(listans[l-1])        
#print(listans2)    
L = len(listans2)
#print(L)
listodd = [listans2[x] for x in range(L) if x%2 ==1]
#print(listodd)
listeven = [listans2[x] for x in range(L) if x%2 ==0]
#print(listeven)
if L%2 == 0:
    if listeven[0]>listodd[0]:
        del listodd[-1]
        ans = sum(listeven)-sum(listodd)
        print(ans)

    else:  
        del listeven[0]
        ans = sum(listodd)-sum(listeven)  
        print(ans)

else:     
    if listeven[0]>listodd[0]:
        ans = sum(listeven)-sum(listodd)
        print(ans)

    else:
        del listeven[-1]
        if len(listeven)>0
        del listeven[0]
        ans = sum(listodd)-sum(listeven)
        print(ans)
        

### FIXED CODE ###

N = int(input())
listh = list(map(int, input().split()))
listans = [listh[0]]
for n in range(1,N-1):
    if (listh[n+1]-listh[n])*(listh[n]-listh[n-1])<=0:
        listans.append(listh[n])
listans.append(listh[N-1])        
#print(listans)
l =len(listans)
listans2 = []
for n in range(l-1):
    if listans[n] == listans[n+1]:
        pass
    else:
        listans2.append(listans[n])
listans2.append(listans[l-1])        
#print(listans2)    
L = len(listans2)
#print(L)
listans3 = [listans2[0]]
for n in range(1,L-1):
    if (listans2[n+1]-listans2[n])*(listans2[n]-listans2[n-1])<=0:
        listans3.append(listans2[n])
listans3.append(listans2[L-1])        
#print(listans3)
ll =len(listans3)
listodd = [listans3[x] for x in range(ll) if x%2 ==1]
#print(listodd)
listeven = [listans3[x] for x in range(ll) if x%2 ==0]
#print(listeven)
if len(listodd) == 0:
    print(listeven[0])
elif ll%2 == 0:
    if listeven[0]>listodd[0]:
        del listodd[-1]
        ans = sum(listeven)-sum(listodd)
        print(ans)

    else:  
        del listeven[0]
        ans = sum(listodd)-sum(listeven)  
        print(ans)

else:     
    if listeven[0]>listodd[0]:
        ans = sum(listeven)-sum(listodd)
        print(ans)

    else:
        del listeven[-1]
        if len(listeven) >= 1:
            del listeven[0]
        ans = sum(listodd)-sum(listeven)
        print(ans)
N = int(input())
X, Y = [], []

tree = {key+1: [] for key in range(N)}  # 木構造はノードをキーにする辞書にしておく
# 必要なのは、あるノードを指定したときに、隣り合うノードと、コスト
#[(隣のノード, コスト)]の順で格納する

for n in range(N - 1):
    a, b, c = list(map(int, input().split()))
    tree[a].append((b, c))
    tree[b].append((a, c))  # 方向に依存しない格納

for n in tree.keys():
    tree[n] = list(set(tree[n]))

Q, K = list(map(int, input().split()))

cost = {}  # Kがkeyに行くまでにかかるコストの辞書


def dfs(v, p, d):
    """
    深さ優先探索
    再帰的に処理する
    args:
        v: 現在の頂点
        p: vの親(訪問元)
        d: 現在の距離
    """
    cost[v] = d
    for i, co in tree[v]:
        if i == p:
            continue
        dfs(i, v, d + co)


dfs(K, 0, 0)

ans = []
for q in range(Q):
    x, y = list(map(int, input().split()))
    ans.append(cost[x] + cost[y])

for a in ans:
    print(a)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

N = int(input())
X, Y = [], []

tree = {key+1: [] for key in range(N)}  # 木構造はノードをキーにする辞書にしておく
# 必要なのは、あるノードを指定したときに、隣り合うノードと、コスト
#[(隣のノード, コスト)]の順で格納する

for n in range(N - 1):
    a, b, c = list(map(int, input().split()))
    tree[a].append((b, c))
    tree[b].append((a, c))  # 方向に依存しない格納

# for n in tree.keys():
#     tree[n] = list(set(tree[n]))  # 重複を削除
# こいつが原因ではない

Q, K = list(map(int, input().split()))

cost = {}  # Kがkeyに行くまでにかかるコストの辞書


def dfs(v, p, d):
    """
    深さ優先探索
    再帰的に処理する
    args:
        v: 現在の頂点
        p: vの親(訪問元)
        d: 現在の距離
    """
    cost[v] = d
    for i, co in tree[v]:
        if i == p:
            continue
        dfs(i, v, d + co)


dfs(K, -1, 0)

# print(cost)
ans = []
for q in range(Q):
    x, y = list(map(int, input().split()))
    ans.append(cost[x] + cost[y])

for a in ans:
    print(a)
D,N = map(int,input().split())
ans = []
for i in range(10000000):
  if i%(100**D) == 0:
    ans.append(i)
    if len(ans) == N:
      break
print(ans[N])


### FIXED CODE ###

import sys
d,n = map(int,input().split())
num = 100**d
if n == 100:
  print(101*num)
  sys.exit()
if d == 0:
  print(n)
else:
  print((100**d)*n)
from collections import defaultdict
import heapq as hq
d = int(input())
c = list(map(int,input().split()))
s = [0]
for i in range(d):
    s.append([0]+list(map(int,input().split())))
dic = defaultdict(int)
contest = [[] for _ in range(27)]
contests = [-1]*(d+1)
for i in range(1,d+1):
    maxscore = 0
    maxcontest = -1
    for k in range(1,27):
        score = 0
        score += s[i][k]
        score += c[k]*(i-dic[k])
        if score > maxscore:
            maxscore = score
            maxcontest = k
    print(maxcontest)
    dic[maxcontest] = i


### FIXED CODE ###

from collections import defaultdict
d = int(input())
c = list(map(int,input().split()))
s = []
for i in range(d):
    s.append(list(map(int,input().split())))
dic = defaultdict(int)
for i in range(1,d+1):
    maxscore = -10000000
    maxcontest = -1
    for k in range(26):
        score = 0
        score += s[i-1][k-1]
        for j in range(26):
            if j != k:
                score -= c[j]*(i-dic[j])
        if score > maxscore:
            maxscore = score
            maxcontest = k
    print(maxcontest+1)
    dic[maxcontest] = i
n, m = map(int, input().split())
score = [(False, 0) for i in range(n)]
for i in range(m):
	problem, s = input().split()
	p = int(problem)-1
	if not score[p][0]:
		if s=="AC":
			score[p][0] = True
		else:
			score[p][1] += 1
	

print(sum(i[0] for i in score), sum(j if i else 0 for i, j in score))

### FIXED CODE ###

n, m = map(int, input().split())
yes = [False for i in range(n)]
negative = [0 for i in range(n)]
score = [0 for i in range(n)]
for i in range(m):
	problem, s = input().split()
	p = int(problem)
	if s=="AC" and not yes[p-1]:
		yes[p-1] = True
		score[p-1] = negative[p-1]
	else:
		negative[p-1] += 1
	

print(sum(yes), sum(score))
# -*- coding: utf-8 -*-

"""
計算式は以下のように示される
C_n = (1/n)*(1+C_(n-1)) + ((n-1)/n)*C_(n-1)  =  C_(n-1)+(1/n)
"""

import math,sys
sys.setrecursionlimit(100000)
N = int(input())
X = list(map(int, input().split()))

def calc(n):
    if n==1:
        return 1.0
    return calc(n-1)+(1.0/n)

ev = 0
for i in range(1,N):
    ev += (X[i]-X[i-1])*calc(i)
    if ev >= (10**9+7):
        ev = ev%(10**9+7)

print(int(ev*math.factorial(N-1)%(10**9+7)))

### FIXED CODE ###

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

mod = 10**9 +7
N = int(input())
X = list(map(int, input().split()))

factorial=[1]
for i in range(1,N):
    factorial.append(factorial[-1] *i %mod)

ans=0
for i in range(1,N):
    ans = (ans*i + (X[-1]-X[i-1])*factorial[i-1]) %mod

print(ans)
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np
 
DIV_NUM = 1000000000 + 7
 
INPUT_NUMS = list(map(int, input().split()))
N=int(INPUT_NUMS[0])
K=int(INPUT_NUMS[1])
 
A = [int(x) for x in input().split()]
AA = np.array(A , dtype='int64')

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

tree = [0] * (N+100)

def BIT_update(x):
    while x <= N:
        tree[x] += 1
        y = x
        z = 1
        while y > 0:
            if y % 2 == 1:
                x += z
                break
            y //= 2
            z *= 2

def BIT_sum(x):
    s = 0
    while x > 0:
        s += tree[x]
        y = x
        z = 1
        while y > 0:
            if y % 2 == 1:
                x -= z
                break
            y //= 2
            z *= 2
    return s
 
answer = N*(N-1)//2
for i in AA:
    answer -= BIT_sum(int(i))
    BIT_update(int(i))

B = sorted(A)
 
q=0
p=B[0]
r=0
for i in range(1,N):
    if B[i]>p:
        p=B[i]
        r=i
    q += r
 
# print(answer,K)
answer = answer % DIV_NUM
answer = int(answer)
answer = (answer * K) % DIV_NUM
q = q % DIV_NUM
answer = answer + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)
 

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

DIV_NUM = 1000000000 + 7

INPUT_NUMS = list(map(int, input().split()))
N=int(INPUT_NUMS[0])
K=int(INPUT_NUMS[1])

A = [int(x) for x in input().split()]
AA = np.array(A)
if N==1:
    print(0)
    exit()

# https://kira000.hatenadiary.jp/entry/2019/02/23/053917
def bubble_sort(A):
    cnt = 0
    for i in range(len(A)):
        for j in range(len(A)-1, i, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                cnt += 1
    return cnt

answer = bubble_sort(AA)

B = sorted(A)
q=0
p=B[0]
r=0
for i in range(1,N):
    if B[i]>p:
        p=B[i]
        r=i
    q += r

# print(answer,K)
answer = answer % DIV_NUM
answer = int(answer)
answer = (answer * K) % DIV_NUM
q = q % DIV_NUM
answer = answer + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)
def transnum(int: n):
    if n % 3 != 0:
        return n + 3 - n % 3
    else:
        return n

while True:
    x,n = tuple(int(i) for i in input().split())
    r = 0
    if x == n == 0:
        break
    amin = n // 3 + 1
    amax = 2 * transnum(n) // 3
    if amax > x:
        amax = x

    A = [j for j in range(amin, amax+1)]

    #print(A)

    for a in A:
        bmin = (n-a) // 3 + 1
        bmax = 2 * transnum(n-a) // 3
        if bmax > a:
            bmax = a

        B = [j for j in range(bmin, bmax) if j+j != n-a]
        #print(B)
        for b in B:
            cmin = (n-a-b) // 3 + 1
            cmax = 2 * transnum(n-a-b) // 3
            if cmax > b:
                cmax = b
            C = [k for k in range(cmin, cmax) if k == n-a-b]
            #print(C)
            r += len(C)
            C.clear()
        B.clear()
    
    print(r)


### FIXED CODE ###

while True:
    n,x = tuple(int(i) for i in input().split())
    if n == x == 0:
        break
    r = 0
    a = [j for j in range(1,n+1)]
    #print(a)
    for l in a:
        b = [k for k in range(1,l)]
        if len(b) == 0:
            continue
        #print(b)
        for m in b:
            c = [o for o in range(1,m) if l+m+o == x]
            #print(c)
            r += len(c)
            c.clear()
        b.clear()
    print(r)
a,b=list(input())
if a==b:
  print('H')
else:
  print('D')

### FIXED CODE ###

a,b=list(input().split())
if a==b:
  print('H')
else:
  print('D')
N,M,X=list(map(int,input().split()))
C=[list(map(int,input().split())) for i in range(N)]
result=[]
for i in range(2**N):
    A=[]
    for j in range(N):
        if (i>>j)&1:
            A.append(C[j])
    result.append(A)
inf=float('inf')
ans2=inf

for i in result:
    D=dict()
    ans1=0
    if i!=[]:
        for j in i:
            ans1+=j[0]
            D[1]=D.get(1,0)+j[1]
            D[2]=D.get(2,0)+j[2]
            D[3]=D.get(3,0)+j[3]
            
        if (D[1]>=X) and (D[2]>=X) and (D[3]>=X):
            ans2=min(ans2,ans1)
if ans2==inf:
    print(-1)
else:
    print(ans2)     

### FIXED CODE ###

N,M,X=list(map(int,input().split()))
C=[list(map(int,input().split())) for i in range(N)]
result=[]
for i in range(2**N):
    A=[]
    for j in range(N):
        if (i>>j)&1:
            A.append(C[j])
    result.append(A)
inf=float('inf')
ans2=inf

for i in result:
    D=dict()
    ans1=0
    ans3=0
    if i!=[]:
        for j in i:
            ans1+=j[0]
            for k,value in enumerate(j):
                if k!=0:
                    D[k]=D.get(k,0)+value
            
        for j in D.values():
            if j>=X:
                ans3+=1
        if ans3==M:
            ans2=min(ans2,ans1)
if ans2==inf:
    print(-1)
else:
    print(ans2)
string=input()
print(string.swapcase()


### FIXED CODE ###

string=input()
print(string.swapcase())
# -*- coding: utf-8 -*-

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

sum1 = aN[0]
cnt = 0
if aN[0] > 0:
    sei = True
elif aN[0] < 0:
    sei = False
else:
    print("和が0なので、これはないはず")

for i in range(1,N):
    sum1 += aN[i]
    if sei:
        if sum1 >= 0:
            tmp = abs(sum1) +1
            cnt += tmp
            sum1 -= tmp
        sei = False
    else:
        if sum1 <= 0:
            tmp = abs(sum1) +1
            cnt += tmp
            sum1 += tmp
        sei = True
print(cnt)

### FIXED CODE ###

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

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

sum1 = 0
cnt1 = 0
for i in range(N):
    sum1 += aN[i]
    if i % 2 == 0:
        if sum1 >= 0:
            tmp = abs(sum1) +1
            cnt1 += tmp
            sum1 -= tmp
    else:
        if sum1 <= 0:
            tmp = abs(sum1) +1
            cnt1 += tmp
            sum1 += tmp

sum1 = 0
cnt2 = 0
for i in range(N):
    sum1 += aN[i]
    if i % 2 == 1:
        if sum1 >= 0:
            tmp = abs(sum1) +1
            cnt2 += tmp
            sum1 -= tmp
    else:
        if sum1 <= 0:
            tmp = abs(sum1) +1
            cnt2 += tmp
            sum1 += tmp

# 開始を偶奇それぞれでやって、良かった方を出力
print(min(cnt1, cnt2))
n,a,b = map(int,input().split())
if(a>b):
  print(0)
else:
  if(n = 1):
    if(a!=b):
      print(0)
    else:
      print(1)
  else:
    print(b*(n-1)+a-(a*(n-1)+b)+1)
  

### FIXED CODE ###

n,a,b = map(int,input().split())
if(a>b):
  print(0)
else:
  if(n == 1):
    if(a!=b):
      print(0)
    else:
      print(1)
  else:
    print(b*(n-1)+a-(a*(n-1)+b)+1)
def sol():
    n,m=map(int,input().split())
    w={}
    p,q=set(),set()
    for i in range(m):
        l,r,d=[int(i) for i in input().split()]
        if l in w:
            w[l].add((r,d))
        else:
            w[l]={(r,d)}
        p.add(l)
        q.add(r)
    s=p-q
    for i in s:
        k={j for j in w[i]}
        g=set()
        cnt=0
        while len(k):
            x=k.pop()
            cnt+=1
            if cnt==100:
                print(p[100])
            if x[0] not in w:
                g.add(x)
            else:
                for j in w[x[0]]:
                    k.add((j[0],j[1]+x[1]))
        y=set()
        for j in g:
            if j[0] in y or j[0]==i:
                print("No")
                exit()
            else:
                y.add(j[0])
    print("Yes" if len(s) or m==0 else "No")

if __name__=="__main__":
    sol()


### FIXED CODE ###

def sol():
    n,m=map(int,input().split())
    t,w={},{}
    p,q=set(),set()
    for i in range(m):
        l,r,d=[int(i) for i in input().split()]
        if l in w: w[l].add((r,d))
        else: w[l]={(r,d)}
        p.add(l)
        q.add(r)
    s=p-q
    chk=set()
    if len(s)==0:
        print(["No","Yes"][m==0])
        exit()
    for i in s:
        chk.add((i,0))
        while len(chk):
            x=chk.pop()
            if x[0] in w:
                for j in w[x[0]]:
                    if (i,j[0]) in t and t[(i,j[0])]!=t[(i,x[0])]+j[1]:
                        print("No")
                        exit()
                    elif (i,j[0]) not in t:
                        #t[(i,j[0])]=t[(i,x[0])]+j[1]
                        t[(i,j[0])]=x[1]+j[1]
                        chk.add((j[0],x[1]+j[1]))
    print("Yes")

if __name__=="__main__":
    sol()
blue=int(input())
b=[]
r=[]
count=[]
for i in range(blue):
  b.append(input())
red=int(input())
for i in range(red):
  r.append(input())
for i in b:
  count.append(b.count(i)-r.count(i))
if max(count)<0:
  print(0)
else:
  print(max(count))

### FIXED CODE ###

A,B,C=map(int,input().split())
print('Yes' if A+B>=C else 'No')
#coding:utf-8

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

start,left = map(int,input().split())
right = left
cnt = 0
for i in range(M-1):
    data = list(map(int,input().split()))
    if data[0] != start:
        start = data[0]
        if data[1] >= left:
            cnt += 1
            left = data[1]
            right = left
    else:
        right = data[1]
    
if data[1] >= right:
    cnt += 1

print(cnt)


### FIXED CODE ###

#coding:utf-8

N,M = map(int,input().split())
List = sorted([list(map(int,input().split())) for i in range(M)], key=lambda x:x[1])

cnt = 1
maxa = 0
b = List[0][1]
for i in range(1,M):
    newB = List[i][1]
    maxa = max(maxa,List[i][0])
    if newB > b:
        if maxa >= b:
            cnt += 1
            b = newB
        maxa = 0
        
print(cnt)
import numpy as np


def acinput():
    return list(map(int, input().split(" ")))



directions=np.array([[1,0],[0,1],[-1,0],[0,-1]])
directions = list(map(np.array, directions))

mod = 10**9+7


def factorial(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact



def serch(x, count):
    #print("top", x, count)
            

    for d in directions:
        nx = d+x
        #print(nx)
        if np.all(0 <= nx) and np.all(nx < (H, W)):
            if field[nx[0]][nx[1]] == "E":
                count += 1 
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)  
                continue
            if field[nx[0]][nx[1]] == "#":
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)    
                 
    return count

H,W,D=acinput()
#Ad={}
Ad=[0]*(H*W+1)
for i in range(H):
    ar=acinput()
    for j,sar in enumerate(ar):
        Ad[sar]=np.array((i,j))

dp = [[0 for j in range(H*W+1)]for i in range(H*W+1)]

for x in range(1, H*W+1):
    dp[x][x]=0

for x in range(1,H*W+1):
    y=x+D
    while True:
        if y > H*W:
            break
        #print(x,y)
        tmp = Ad[y]-Ad[y-D]
        S = np.sum(np.abs(tmp[0])+abs(tmp[1]))
        dp[x][y]=dp[x][y-D]+S
        y+=D
        

#print(np.array(dp))

Q=int(input())
for i in range(Q):
    l,r=acinput()
    print(dp[l][r])


### FIXED CODE ###


#import numpy as np


def acinput():
    return list(map(int, input().split(" ")))


mod = 10**9+7


def factorial(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact


H, W, D = acinput()
# Ad={}
Ad = [0]*(H*W+1)
for i in range(H):
    ar = acinput()
    for j, sar in enumerate(ar):
        # Ad[sar]=np.array((i,j))
        Ad[sar] = (i, j)

#dp = [[0 for j in range(H*W+1)]for i in range(H*W+1)]
d = [0]*(H*W+1)

# for x in range(1, H*W+1):
#    dp[x][x]=0

y = D+1
while True:
        if y > H*W:
            break
        # print(x,y)
        #tmp = Ad[y]-Ad[y-D]
        #S = np.sum(np.abs(tmp[0])+abs(tmp[1]))
        #tmp = Ad[y]-Ad[y-D]
        S = abs(Ad[y][0]-Ad[y-D][0])+abs(Ad[y][1]-Ad[y-D][1])

        # dp[x][y]=dp[x][y-D]+S
        d[y] = d[y-D]+S
        y += 1


# print(np.array(dp))

Q = int(input())
for i in range(Q):
    l, r = acinput()
    print(d[r]-d[l])


# print(Ad)
# print(np.array(dp))
#print(d)
import itertools as itl

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

for mi in M:
    flg = False
    for i in range(len(A)):
        C = itl.combinations(A, i)
        for j in C:
            if sum(j) == mi:
                flg = True
                break
    if flg: print("yes")
    else: print("no")


### FIXED CODE ###

import itertools as itl

n = int(input())
A = list(map(int, input().split()))
q = int(input())
M = list(map(int, input().split()))
S = []

for i in range(n):
    cmb = list(itl.combinations(A, i+1))
    for j in cmb:
        S.append(sum(j))

for m in M:
    flg = False
    for s in S:
        if s == m:
            flg = True
            break
    if flg:
        print("yes")
    else:
        print("no")
a,b,c=map(int,input().split())
x,y,z=sorted(a,b,c)
print('Yes' if x+y==z else 'No')


### FIXED CODE ###

a,b,c=sorted(map(int,input().split()))
print('Yes' if a+b==c else 'No')