Harryxun/stf_run huggingface dataset:
import sys
def p(s):
  sys.stderr.write(str(s)+"\n")

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

p(N)
p(Y)

Amax=min(N,Y//10000)
Bmax=min(N,Y//5000)
Cmax=min(N,Y//1000)

p(Amax)
p(Bmax)
p(Cmax)

for a in range(Amax,-1,-1):
  B=min(Bmax,N-a)
  p("B="+str(B))
  for b in range(B,-1,-1):
    C=min(Cmax,N-a-b)
    p("a="+str(a)+", B="+str(B)+", C="+str(C))
    for c in range(C,-1,-1):
      n = a+b+c
      y = (a*10000)+(b*5000)+(c*1000)
      if n==N and y==Y:
        print(a,b,c,sep=" ")
        exit(1)

print("-1 -1 -1")


### FIXED CODE ###

import sys
def p(*a):
  s=" ".join(map(str,a))
  #print(s)
  sys.stderr.write(s+"\n")

N,Y=map(int, input().split())
p(N,Y)

NAmax=min(N,Y//10000)
NBmax=min(N,Y//5000)
NCmax=min(N,Y//1000)
p(NAmax, NBmax, NCmax)

NA=NAmax
for a in range(NA,-1,-1):
  NB=min(NBmax,N-a)

  for b in range(NB,-1,-1):
    c = N-a-b
    y = (a*10000)+(b*5000)+(c*1000)
    if y==Y:
      print(a,b,c,sep=" ")
      exit()
      
i=-1
print(i,i,i, sep=" ")
from numba import jit
@jit
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    a.sort(reverse = True)
    ans = 0
    for i in range(n):
        if a.count(a[i]) >= 4:
            ans = a[i]*a[i]
            break
        elif a.count(a[i]) >=2:
            for j in range(i+a.count(a[i]),n):
                if a.count(a[j]) >=2:
                    ans = a[i]*a[j]
                    break
            break
    print(ans)
main()

### FIXED CODE ###

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

a.sort(reverse = True)
ans = 0
b = a.copy()
b = list(set(b))
b.sort(reverse = True)
c = [0]*len(b)
j = 0
c[j] = 1
for i in range(1,n):
    if a[i-1] == a[i]:
        c[j] +=1
    else:
        j+=1
        c[j] +=1
for i in range(len(b)):
    if c[i] >= 4:    
        
        ans = b[i]*b[i]
        break
    elif c[i] >= 2:
        for j in range(i+1,len(b)):
            if c[j] >= 2:
                ans = b[i]*b[j]
                break
        break
print(ans)
a,_,b,_,c=int(input())
print(a*b/2)

### FIXED CODE ###

a,b,c=map(int,input().split())
print(a*b//2)
str = input()
num = list(map(int,str.split(' ')))
if !(num[0]%2)*(num[1]%2)*(num[2]):
	print(0)
else:
	num.sort()
print(num[0]*num[1])


### FIXED CODE ###

str = input()
num = list(map(int,str.split(' ')))
if ((num[0]%2)and(num[1]%2)and(num[2]%2))==0:
	print(0)
else:
	num.sort()
	print(num[0]*num[1])
return "".join(input().split()[::-1])

### FIXED CODE ###

print("".join(input().split()[::-1]))
1<= N(int) <=100

if N(int) % 2 ==0:
  print(1/2)

else:
  N(int) % 2 !=0:
  x = N(int)- (N(int)+1)/2
  print(x/N(int))

### FIXED CODE ###

N = input()
1 <= int(N) <= 100

if int(N) % 2 == 0:
  print(float(1/2))

else:
  x = (int(N)+1)/2
  print(float(x/int(N)))
l,r,d = map(input().split(), int)
ans=0

for i = range(l,r+1):
    if (i%d == 0) ans += 1

print(ans)

### FIXED CODE ###

l,r,d = map(int, input().split())
ans=0

for i in range(l,r+1):
    if (i%d == 0): ans += 1

print(ans)
#!/usr/bin/env python3
import sys
import numpy as np

def solve(N: int, M: int, edges, S: int, T: int):
    S -= 1
    T -= 1
    now = np.zeros(10**5)
    now[S] = 1
    seen = now > 0
    c = 0
    s = 0
    while s < np.count_nonzero(seen):
        c += 1
        s = np.count_nonzero(seen)
        now = now.dot(edges)
        if now[T]:
            print(c)
            sys.exit(0)
        seen |= (now > 0)
    print(-1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    Mat = np.zeros((10**5, 10**5))
    for _ in range(M):
        u, v = int(next(tokens)) - 1, int(next(tokens))-1
        Mat[u][v] = 1
        #Mat[v][u] = 1


    Three = np.copy(Mat)
    for _ in range(2):
        Three = Three.dot(Mat)

    #print(Three)

    S = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    solve(N, M, Three, S, T)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import deque

def solve(N: int, M: int, G, S: int, T: int):
    S -= 1
    T -= 1
    now = deque([S])
    dist = [0 for _ in range(N * 3)]
    while now:
        p = now.popleft()
        for n in G[p]:
            if dist[n] != 0:
                continue
            dist[n] = dist[p] + 1
            if n == T:
                print(dist[n] // 3)
                exit()
            now.append(n)
    print(-1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    G = tuple(set() for _ in range(N * 3))
    for _ in range(M):
        u, v = int(next(tokens)) - 1, int(next(tokens))-1
        G[u].add(v + N)
        G[u + N].add(v + 2 * N)
        G[u + 2 * N].add(v)

    S = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    solve(N, M, G, S, T)

if __name__ == '__main__':
    main()
def last_num(a):
    while a//10!=0:
        a=a%10
    return a

def marume(a):
    b=a
    while a//10!=0:
        a=a%10
    if a!=0:
        b=b-a+10
    return b

A=[int(input())for _ in range(5)]
last_order=9
ans=0
for i in range(5):
    if 0 < last_num(A[i]) < last_order:
        last_order=last_num(A[i])
        order_num=i
for j in range(5):
    if j !=order_num:
        ans+=marume(A[j])
    else:
        ans+=A[j]
print(ans)


### FIXED CODE ###

def last_num(a):
    while a//10!=0:
        a=a%10
    return a

def marume(a):
    b=a
    while a//10!=0:
        a=a%10
    if a!=0:
        b=b-a+10
    return b

A=[int(input())for _ in range(5)]
last_order=9
order_num=0
ans=0
for i in range(5):
    if 0 < last_num(A[i]) < last_order:
        last_order=last_num(A[i])
        order_num=i
for j in range(5):
    if j !=order_num:
        ans+=marume(A[j])
    else:
        ans+=A[j]
print(ans)
a,b,c=map(int,input().split())
print(a if b==c else b if a==c else c if a==b)

### FIXED CODE ###

a,b,c=map(int,input().split())
print(a if b==c else b if a==c else c)
input = _input().__next__
n, p = [int(c) for c in input().split()]
s = input()    

if p in (2,5):
    a = tuple(int(c)%p for c in s)
    out = 0
    for i,x in enumerate(a):
        if x==0:
            out += (i + 1)
else:
    a = [0]*n
    tmp = 0
    for i in reversed(range(n)):
        tmp = (tmp * 10 + int(s[i])) % p
        a[i] = tmp
    d = {i: 0 for i in range(p)}
    d[0] = 1
    out = 0
    for x in a[::-1]:
        out += d[x]
        d[x] += 1
print(out)

### FIXED CODE ###


def hoge():

    n, p = [int(c) for c in input().split()]
    s = input()    

    if p in (2,5):
        a = tuple(int(c)%p for c in s)
        out = 0
        for i,x in enumerate(a):
            if x==0:
                out += (i + 1)
    else:
        a = [0]*n
        tmp = 0
        for i in reversed(range(n)):
            tmp = (tmp + pow(10, n-i-1, p) * int(s[i])) % p
    #         tmp = (tmp + 10**(n-i-1) * int(s[i])) % p
            a[i] = tmp
        d = {i: 0 for i in range(p)}
        d[0] = 1
        out = 0
        for x in a[::-1]:
            out += d[x]
            d[x] += 1
    print(out)
hoge()
s = input()
k = False
if s[0] != 'A':
    print('WA')
    exit()
else:
    for i in range(len(s)-1):
        if s[i] == 'C':
            s = s[1:i-1] + s[i+1:]
            k =s.islower()
print('AC' if k else 'WA')

### FIXED CODE ###

s = str(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and (s[1:s.find('C')]+s[s.find('C')+1:]).islower():
    print('AC')
else:
    print('WA')
N, M = map(int,input().split())

return(int(N(N-1)//2 + M(M-1)//2))

### FIXED CODE ###

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

print(int(N * (N-1)//2 + M * (M-1)//2))
a = input()
print(a[0]+len(a)+a[-1])

### FIXED CODE ###

a = input()
print(a[0]+str(len(a)-2)+a[-1])
N = int(input())
mod = 10 ** 9 + 7
def fact(n):
    if n == 1:
        return 1
    return n * fact(n-1)

answer = fact(N)
print(answer % mod)

### FIXED CODE ###

N = int(input())
mod = 10 ** 9 + 7
answer = 1
for i in range(2, N+1):
    answer *= i
    answer %= mod

print(answer)
L, R = map(int, input().split())

L_1 = L % 2019
R_1 = R % 2019

idx1 = 0
listA = []
for idx1 in range(L_1, R_1):
  idx2 = idx1 + 1
  for idx2 in range(idx1 + 1, R_1 + 1):
    listA.append(idx1 * idx2)

print(min(listA))

### FIXED CODE ###

L, R = map(int, input().split())

listX = []
for i in range(1, 990590):
  listX.append(i*2019)

sw = 0
for n in range(len(listX)):
  if L < listX[n] and R > listX[n]:
    sw += 1

if sw > 0:
  print(0)

elif sw == 0:
  idx1 = 0
  listA = []
  for idx1 in range(L, R):
    for idx2 in range(idx1 + 1, R + 1):
      listA.append(idx1 * idx2)
 
  idx3 = 0
  listB = []
  for idx3 in range(len(listA)):
    listB.append(listA[idx3] % 2019)
 
  print(min(listB))
n=int(input())
s=input()
if("Y" in s):
      print("Four")
else:
      print("Three")

### FIXED CODE ###

N=int(input())
print(int(N/3))
while 1:
    n,m= list(map(int,input().split(' ')))
    if n ==m ==0:break
    D =[]
    for _ in range(n):
        d_i,p_i = list(map(int,input().split(' ')))
        D.append((d_i,p_i))
    sorted(D,key = lambda x:x[0])
    while m > 0:
        temp = D.pop(0)
        if temp[0] > m:
            temp = (temp[0] - m,temp[1])
            m=0
        else: 
            m -= temp[0]
            temp = (0,temp[1])
        D = D + [temp]
    ans = 0
    for i in D:
        ans += i[0]*i[1]
    print(ans)


### FIXED CODE ###

while 1:
    n,m= list(map(int,input().split(' ')))
    if n == m ==0:break
    D = []
    for _ in range(n):
        d_i,p_i = list(map(int,input().split(' ')))
        D.append((d_i,p_i))
    D = sorted(D,key = lambda x:x[1],reverse = True)
    while m > 0:
        if len(D) ==0:break
        temp = D.pop(0)
        if temp[0] > m:
            temp = (temp[0] - m,temp[1])
            m=0
            D.append(temp)
        else: 
            m -= temp[0]      
    ans = 0
    for i in D:
        ans += i[0]*i[1]
    print(ans)
N = input()

while len(N) > 1:
    M = sum(int(N[i]) for i in range(len(N)))
    N = str(M)

if M == 9:
    print('Yes')
else:
    print('No')



### FIXED CODE ###

N = input()

if int(N) % 9 == 0:
    print('Yes')
else:
    print('No')
a = input()
s = list(a)
s_int = [int(i) for i in s ]
t = len(s_int)
i = 0
while 0 in s_int and 1 in s_int and i < len(s_int):
    if s_int[i] == 0 and s_int[i+1] == 1:
        s_int.pop(i)
        s_int.pop(i)
    elif s_int[i] == 1 and s_int[i+1] == 0:
        s_int.pop(i)
        s_int.pop(i)
    else:
        i += 1
print(t - len(s_int))

### FIXED CODE ###

a = input()
s = list(a)
s_int = [int(i) for i in s ]
t = len(s_int)
i = 0
c0 = s_int.count(0)
c1 = s_int.count(1)
if c0 > c1:
    print(2*c1)
else:
    print(2*c0)
#best
N=int(input())
a=list(map(int, input().split()))
import fractions
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = fractions.gcd(ans, a[i])
    if ans==1:
        break
print(ans)

### FIXED CODE ###

#C - Monsters Battle Royale(ABC118)
N=int(input())
A=list(map(int, input().split()))
B=min(A)
i=0
n=1
while i<N:
    a=A[i]%B
    i+=1
    if 0<a<B:
        B=a
        i=0
    elif 0<a:
        i-=1
        A[i]=a
    elif B==1:
        break
print(B)
c = 0
a,b = map(int,input())
for i in range(1,a-b):
    c = c + i
print(a-c)


### FIXED CODE ###

i = int(input())
if i <= 999:
    print("ABC")
else:
    print("ABD")
import sys
def input():
    return sys.stdin.readline().strip()

def main():
    A, B = input().split()
    if int(A) == 0 or int(B) == 0:
        print(0)
        return
    A = int(A)
    B = int(float(B)*100)
    print(A*B//100)


main()

### FIXED CODE ###

import sys
import decimal
def input():
    return sys.stdin.readline().strip()
 
def main():
    A, B = input().split()
    A = decimal.Decimal(A)
    B = decimal.Decimal(B)
    print(int(A*B))
 
 
main()
X = int(input())
A = int(input())
if X % 500 <= A:
	print('Yes')
eise:
	print('No')

### FIXED CODE ###

X = int(input())
A = int(input())
if X % 500 <= A:
	print('Yes')
else:
	print('No')
D, G = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(D)]

def func(i, t):
    if i == 0 or i > D:
        return 10 ** 9
    
    # Solve all problems, or part of them
    k = min(t // (100 * i), X[i][0])
    s = 100 * i * k
    
    # If all problems are solved, add bonus
    if k == X[i][0]:
        s += X[i][1]
        
    # If score < objective, go next step
    if s < t:
        k += func(i - 1, t - s)
        
    # Select minimum number of solved problems
    # k: solve i-th line
    # func(i-1,t): pass i-th line
    return min(k, func(i - 1, t))

# Solve backward
print(func(D, G))

### FIXED CODE ###

D, G = map(int, input().split())
X = [0] + [list(map(int, input().split())) for _ in range(D)]

def func(i, t):
    if i == 0 or i > D:
        return 10 ** 9
    
    # Solve all problems, or part of them
    k = min(t // (100 * i), X[i][0])
    s = 100 * i * k
    
    # If all problems are solved, add bonus
    if k == X[i][0]:
        s += X[i][1]
        
    # If score < objective, go next step
    if s < t:
        k += func(i - 1, t - s)
        
    # Select minimum number of solved problems
    # k: solve i-th line
    # func(i-1,t): pass i-th line
    return min(k, func(i - 1, t))

# Solve backward
print(func(D, G))
N, M=(int(i) for i in input().split())
P=[[int(i) for i in input().split()] for  _ in range(M)]
P=[[P[i][0]-1,P[i][1]] for i in range(M)]
f=True

ans=["*"]*N
for i in range(M):
    if ans[P[i][0]]!="*" and ans[P[i][0]]!=str(P[i][1]):
        print(-1)
        f=False
    else:
        ans[P[i][0]]=str(P[i][1])
if N==1 and P[0][1]==0 and f:
    print(0)
else:
    if f:
        if ans[0]=="*":
            ans[0]="1"
        for i in range(1,N):
            if ans[i]=="*":
                ans[i]="0"
        if len(str(int("".join(ans))))==N:
            print(int("".join(ans)))
        else:
            print(-1)

### FIXED CODE ###


N, M=(int(i) for i in input().split())
P=[[int(i) for i in input().split()] for  _ in range(M)]
P=[[P[i][0]-1,P[i][1]] for i in range(M)]
f=True

ans=["*"]*N
for i in range(M):
    if ans[P[i][0]]!="*" and ans[P[i][0]]!=str(P[i][1]):
        print(-1)
        f=False
    else:
        ans[P[i][0]]=str(P[i][1])
if M>0:
    if N==1 and P[0][1]==0 and f:
        print(0)
    else:
        if f:
            if ans[0]=="*":
                ans[0]="1"
            for i in range(1,N):
                if ans[i]=="*":
                    ans[i]="0"
            if len(str(int("".join(ans))))==N:
                print(int("".join(ans)))
            else:
                print(-1)
else:
    if N==1:
        print(0)
    elif N==2:
        print(10)
    else:
        print(100)
k = int(input())

import math
ans = sum(list(range(k+1)))
ans1 = 0
ans2 = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        ans1 += math.gcd(i,j)

ans = ans + ans1*3

for i in range(1,K+1):
    for j in range(1,i):
        for l in range(1,l):
            ans2 += math.gcd(math.gcd(i,j),l)

ans += ans2*6
print(ans)

### FIXED CODE ###

k = int(input())

import math
ans = 0
ans1 = 0
ans2 = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        ans1 += math.gcd(i,j)

ans = ans + ans1*3

for i in range(1,k+1):
    for j in range(1,i):
        for l in range(1,j):
            ans2 += math.gcd(math.gcd(i,j),l)

ans += ans2*6
print(ans-sum(list(range(k+1)))*2)
a = int(input())
if a == 17 :
  print('YES')
else :
  print('NO')

### FIXED CODE ###

if input() in ('5 5 7', '5 7 5', '7 5 5') :
  print('YES')
else :
  print('NO')
x,y=map(int,input().split())
print(">" if x>y else "<" if x<y else "=")

### FIXED CODE ###

x,y=input().split()
print(">" if x>y else "<" if x<y else "=")
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''

N, Q = map(int, input().split())
S = [0] * N
T = [0] * N
X = [0] * N
D = [0] * Q
event = []
working = []
for i in range(N):
	S[i], T[i], X[i] = map(int, input().split())
	event.append((S[i] - X[i], 1, X[i]))
	event.append((T[i] - X[i], -1, X[i]))
	
for i in range(Q):
	D[i] = int(input())
	
event.sort()
j = 0
for i in range(len(event)):		
	while event[i][0] > D[j] and j < Q:
		if len(working) > 0:
			print(min(working))
		else:
			print(-1)
		j += 1
	
	if event[i][1] == 1:
		working.append(event[i][2])
	else:
		working.remove(event[i][2])

while j < Q:
	print(-1)
	j += 1

### FIXED CODE ###

import bisect
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''

N, Q = map(int, input().split())
S, T, X = [0] * N, [0] * N, [0] * N
work = []

for i in range(N):
	S[i], T[i], X[i] = map(int, input().split())
	work.append((X[i], S[i] - X[i], T[i] - X[i]))

D = [int(input()) for _ in range(Q)]

work.sort()
ans = [-1] * Q
skip = [-1] * Q

for i in range(N):
	left = bisect.bisect_left(D, work[i][1])
	right = bisect.bisect_left(D, work[i][2])
	
	while left < right:
		if skip[left] == -1:
			skip[left] = right
			ans[left] = work[i][0]
			left += 1
		else:
			left = skip[left]					
		
for i in ans:
	print(i)
x = int(input())
n = 10 ** 9
for b in range(n):
    a = (x + b ** 5) ** 0.2
    if a == int(a):
        a = int(a)
        break
    b *= -1
    a = (x + b ** 5) ** 0.2
    if a == int(a):
        a = int(a)
        break
print(a, b)

### FIXED CODE ###

x = int(input())
for a in range(-118, 120):
    for b in range(-119, 119):
        if a ** 5 - b ** 5 == x:
            print(a, b)
            exit()
s = list(input())
s.sort()
if s[0]==s[1] and  s[2]==s[3]:
  print(Yes)
else:
  print("No")

### FIXED CODE ###

s = list(input())
s.sort()
if s[0]==s[1] and  s[2]==s[3] and s[0]!=s[2]:
  print("Yes")
else:
  print("No")
n,k=map(int, input().split())
ds=[]
for i in range(len(k)):
  ds.append(input())
ans=n
while ds in ans:
  ans+=1
print(str(ans))
  

### FIXED CODE ###

n,k=map(int, input().split())
ds=list(map(str, input().split()))
while any(i in str(n) for i in ds):
  n+=1
print(str(n))
vals = input.split()

a = int(vals[0])
b = int(vals[1])

print (a * b)

### FIXED CODE ###

vals = [int(v) for v in input().split()]
print(vals[0] * vals[1])
N = int(input())
List = [int(i) for i in input().split()]
count = 0
for j in range(N):
    if(List[j] != j+1):
        count+=1
if(count <= 2):
    print("YES")
else:
    print("NO")


### FIXED CODE ###

A,B=(int(x) for x in input().split())
C = int((A + B))

if(C%2 == 1):
    print("IMPOSSIBLE")
else:
    K = C / 2
    print(int(K))
s = sorted(list(input()))
t = sorted(list(input()), reverse = True)

Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 
         'u', 'v', 'w', 'x', 'y', 'z']

for i in range(len(s)+1):
    if i == len(s):
        if len(t) > len(s):
            print('Yes')
        else:
            print('No')
    elif Alpha.index(s[i]) < Alpha.index(t[i]):
        print('Yes')
        break
    elif Alpha.index(s[i]) > Alpha.index(t[i]):
        print('No')
        break
    else:
        continue



### FIXED CODE ###

s = sorted(list(input()))
t = sorted(list(input()), reverse = True)

Alpha = ['0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 
         'u', 'v', 'w', 'x', 'y', 'z']

while len(s) != len(t):
    if len(s) > len(t):
        t.append('0')
    else:
        s.append('0')

for i in range(len(s)+1):
    if i == len(s):
        print('No')
    elif Alpha.index(s[i]) < Alpha.index(t[i]):
        print('Yes')
        break
    elif Alpha.index(s[i]) > Alpha.index(t[i]):
        print('No')
        break
    else:
        continue
mport sys

def main():
    N, X = map(int, input().split())
    A = list(map(int, input().split()))
    cnt = 1
    D = 0
    for a in A:
        D += a
        if D > X:
            break
        cnt += 1

    return cnt

if __name__ == '__main__':
    print(main())

### FIXED CODE ###

import sys

def main():
    N, X = map(int, input().split())
    A = list(map(int, input().split()))
    cnt = 1
    D = 0
    for a in A:
        D += a
        if D > X:
            break
        cnt += 1

    return cnt

if __name__ == '__main__':
    print(main())
a = int,raw_input()
for i in range(0,a):
	x, y, z = map(int,raw_input().split())
	if(x > y > z or x > z > y and x*x == y*y + z*z):
		print 'YES'
	elif(y > x > z or y > z > x and y*y == x*x + z*z):
		print 'YES'
	elif(z > x > y or z > y > z and z*z == x*x + y*y):
		print 'YES'
	else:
		print 'NO'

### FIXED CODE ###

n = int(raw_input())
for i in xrange(n):
	a = map(int,raw_input().split())
	a.sort()
	if a[0]**2 + a[1]**2 == a[2]**2:
		print 'YES'
	else:
		print'NO'
A, B, C, X = [list(map(input() for i in range(4)))]

print(sum(500*a + 100*b + 50*c == X for a in range(A + 1) for b in range(b + 1) for c in range(c + 1)))

### FIXED CODE ###

A, B, C, X = [int(input()) for i in range(4)]

print(sum(500*a + 100*b + 50*c == X for a in range(A + 1) for b in range(B + 1) for c in range(C + 1)))
import math
def main():
    r = float [int(i) for i in input().sprit()]
    print ("%f %f" % (r ** 2 * math.pi,  2 * r * math.pi))

if __name__ == '__main__':
    main()

### FIXED CODE ###

import math
r = float(input())

s = r * r * math.pi
l = r * 2 * math.pi

print("{0:.5f} {1:.5f}".format(s, l))
print(["YES","NO"][bool(len(list(multiset(input().split())-multiset([5,5,7]))))])

### FIXED CODE ###

l=input().split();list.sort(l);print(["NO","YES"][l==["5","5","7"]])
import bisect

INF = 10 ** 9
A, B, Q = map(int, input().split())
shrine_list = [-INF] + [int(input()) for i in range(A)] + [INF]
temple_list = [-INF] + [int(input()) for i in range(B)] + [INF]
question_list = [int(input()) for i in range(Q)]

for q in question_list:
    b, d = bisect.bisect_right(shrine_list, q), bisect.bisect_right(temple_list, q)
    ans = INF
    for s in [shrine_list[b - 1], shrine_list[b]]:
        for t in [temple_list[d - 1], temple_list[d]]:
            ans = min(abs(q - s) + abs(t - s), abs(q - t) + abs(s - t), ans)
    print(ans)

### FIXED CODE ###

import bisect

INF = 10 ** 18
A, B, Q = map(int, input().split())
shrine_list = [-INF] + [int(input()) for i in range(A)] + [INF]
temple_list = [-INF] + [int(input()) for i in range(B)] + [INF]
question_list = [int(input()) for i in range(Q)]
for q in question_list:
    b, d = bisect.bisect_right(shrine_list, q), bisect.bisect_right(temple_list, q)
    ans = INF
    for s in [shrine_list[b - 1], shrine_list[b]]:
        for t in [temple_list[d - 1], temple_list[d]]:
            ans = min(abs(q - s) + abs(t - s), abs(q - t) + abs(s - t), ans)
    print(ans)

'''
二分検索
深さ優先検索
幅優先検索
累積和
尺取法
動的計画法
mod
XOR
データ構造
'''