Harryxun/stf_run huggingface dataset:
import numpy as np
from collections import Counter
def f(lst):
    return np.cumsum(lst)

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

res = 0
for i in range(n):
    tmp_lst = lst[i:]
    c = dict(Counter(f(tmp_lst)))
    if 0 in c:
       res += c[0]
print(res)

### FIXED CODE ###

import numpy as np
from collections import Counter
def f(lst):
    return np.cumsum([0] + lst)

n = int(input())
lst = list(map(int,input().split()))
d = dict(Counter(f(lst)))

res = 0
for k,v in d.items():
    if v >= 2:
        res += (v*(v-1))//2
print(res)
# -*- coding: utf-8 -*-
n = int(raw_input())
li = list(map(int, input().split()))

for i in range(n):
    sl.append("".join(sorted(li[i])))

sl.sort()

c = collections.Counter(sl)

print(N - (len(c)-1))

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(raw_input())
cnt = 0
dic = {}

for _ in xrange(N):
	rs = ''.join(sorted(raw_input()))
	
	if rs in dic:
		cnt += dic[rs]
		dic[rs] += 1
	else:
		dic[rs] = 1
print cnt
R = int(input())

if R < 1200:
  r = 'ABC'
elif R < 2800:
  r = 'ARC':
else:
  r ='AGC'

print(r)

### FIXED CODE ###

R = int(input())
 
if R < 1200:
  r = 'ABC'
elif R < 2800:
  r = 'ARC'
else:
  r ='AGC'
 
print(r)
import math
while True:
    try:
        a, b = sorted(map(int, input().split()))
    except:
        break
    gcd = math.gcd(a, b)
    lcm = (a*b) // gcd
    print(gcd, lcm)

### FIXED CODE ###

def GCD(m, n):
    while n:
        m, n = n, m % n
    return m

while True:
    try:
        a, b = map(int, input().split())
    except:
        break
    if a < b:
        a, b = b, a
    gcd = GCD(a, b)
    lcm = (a * b) // gcd
    print(gcd, lcm)
S = input()

if len(S)%2==0:
  half_index = len(S)//2
else:
  half_index = len(S)//2 - 1
  
count = 0
for i in range(half_index+1):
  if S[i]!=S[-(i+1)]
  	count = count + 1
    
print(count)

### FIXED CODE ###

S = list(input())

count = 0

for i in range(len(S)//2):
  if S[i]!=S[-(i+1)]:
  	count = count + 1
   
  
print(count)
S = input()
text = ['dream','dreamer','erase','eraser']

def search(s):
  if len(s) == 0:
    return 1
  
  flg = 0
  for t in text:
    if len(s) < len(t):
      continue
    if s.find(t) == 0:
      flg |= search(s[len(t):])
      
  return flg

if search(S):
  print('YES')
else:
  print('NO')
      

### FIXED CODE ###

S = input()[::-1]
text = ['dream','dreamer','erase','eraser']
text = [t[::-1] for t in text]

while len(S) > 0:
  for t in text:
    if S.find(t) == 0:
      S = S[len(t):]
      break
  else:
    print('NO')
    break
else:
  print('YES')
a, b, c = map(int, input())
if a == b:
  print(c)
elif a == c:
  print(b)
else:
  print(a)

### FIXED CODE ###

a, b, c = map(int, input().split())
if a == b:
  print(c)
elif a == c:
  print(b)
else:
  print(a)
K, A, B = map(int, input().split())
count = 0
for i in range(A, B+1):
    if i % K == 0:
        count += 1
print('OK' if count > 0 else 'NG')

### FIXED CODE ###

count, K = 0, int(input())
A, B = map(int, input().split())
for i in range(A, B+1):
    if i % K == 0:
        count += 1
print('OK' if count > 0 else 'NG')
a = int(input())
b = int(input())
print(a+b if b%a == 0 else a-b)

### FIXED CODE ###

a,b = map(int,input().split())
print(a+b if b%a == 0 else b-a)
import sys
 
def fibo(n):
    a, b = 0, 1
    if n == 1:
        return 1
    else:
        for i in range(n):
            a0 = a
            a = b
            b = a0 + b
        return b
        
N, M = map(int, input().split())
a = []
 
if M == 0:
    print(fibo(N) % 1000000007)
    sys.exit()
 
for i in range(M):
    a.append(int(input()))
    
for j in range(len(a)-1):
    if a[j+1] - a[j] == 1:
        print(0)
        sys.exit()
    
hole = 0
pattern = 1
 
for i, k in enumerate(a):
    if i == 0:
        pattern *= fibo(k-1)
    else:
        if i > 0:
            pattern *= fibo(a[i]-a[i-1]-2)
        
pattern *= fibo(N-a[-1]-1)
print(pattern % 1000000007)

### FIXED CODE ###

L = list(map(int,input().split()))
L.sort()
print(L[0]+L[1])
n=int(input())
dat = list(map(int, input().split()))
dan = []
for e in dat:
    e = str(bin(e))
    e=list(e)
    
     
                

         
           




### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    t = 0
    while True:
        for i in range(N):
            if A[i] % 2 == 0:
                A[i] //= 2
            else:
                print(t)
                sys.exit()
        t += 1

main()
n = int(input())
*w, = open(0).read().split()
for i in range(1,n):
  if w.count(w[i]) > 1 or w[i-1][-1] == w[i][0]:
    print('No')
    break
  else: 
    print('Yes')

### FIXED CODE ###

n = int(input())
w=[]
for i in range(n):
    w.append(input())
a=0
for i in range(1,n):
    if w.count(w[i])==1 and w[i-1][-1]==w[i][0]:
       a += 1
    else:
        print('No')
        break
    if a==n-1:
        print('Yes')
    else:
        pass
for s in sys.stdin:
	s = map(int, s.split())
	if len(s)==1:
		continue
	else:
		(pm,pe,pj) = tuple(s)
		if 100 in (pm,pe,pj): c = "A"
		elif pm+pe>=180: c = "A"
		elif pm+pe+pj>=240: c = "A"
		elif pm+pe+pj>=240: c = "B"
		elif pm+pe+pj>=150 and (pm>=80 or pe>=80): c = "B"
		else: c = "C"
	print c

### FIXED CODE ###

import sys
for s in sys.stdin:
	s = map(int, s.split())
	if len(s) == 1:
		continue
	else:
		(pm, pe, pj) = tuple(s)
		if 100 in (pm, pe, pj): c = "A"
		elif pm + pe >= 180: c = "A"
		elif pm + pe + pj >= 240: c = "A"
		elif pm + pe + pj >= 210: c = "B"
		elif pm + pe + pj >= 150 and (pm >= 80 or pe >= 80): c = "B"
		else: c = "C"
	print c
def isP(n):
	for i in prime:
		if i >= n:
			break
		if n%i == 0:
			return False
	return True

r = int(10000001**0.5)
s = int(r**0.5)
p = [1]*r
p[0] = p[1] = 0
for i in range(2,s):
	if p[i]:
		p[2*i::i] = [0 for x in range(2*i,r,i)]
prime = []
for i in range(r):
	if p[i]:
		prime.append(i)

while 1:
	n = input()
	if n == 0: break
	i = n-(1-n%2)
	while i > 12:
		if not isP(i-8) or not isP(i-2):
			i -= 4
			continue
		if isP(i) and isP(i-6):
			print i
			break
		i -= 2

### FIXED CODE ###

ref = [[[10,8],[4,4]],[[10,2],[4,2]]]
r =10000001
p = [1]*r
p[0]= p[1] = 0
for i in range(int(r**0.5)):
	if p[i]:
		p[2*i::i] = [0]*len(p[2*i::i])
		
while 1:
	try:
		n = input()
		if n == 0: break
		n -= 1-n%2
		while any(not p[n-i] for i in [0,2,6,8]):
			n -= ref[p[n-2]][p[n-6]][p[n-8]]
		print n
	except:
		pass
import math
N,K = map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
    print(int(combinations_count(N-K+1, i)*combinations_count(K-1, i-1)%1000000007))

### FIXED CODE ###

import math
N,K = map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

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 = 1000000007
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 )

for i in range(1,K+1):
    # print(i)
    if N-K+1-i<0:
        print(0)
    else:
        first = int(cmb(N-K+1, i,mod))
        last  = int(cmb(K-1, i-1,mod))
        print((first*last)%mod)
n = int(input())
c=list(map(int, input().split())) 

n_pos = 0
max_c = 0
for i in c:
  if i>=max:
  	n_pos += 1
    max_c = i
  else:
    pass
print(n_pos)

### FIXED CODE ###

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

n_pos = 0
max_c = 0
for i in c:
    if i>=max_c:
        n_pos += 1
        max_c = i
    else:
        pass
print(n_pos)
import math
N = int(input())
neck = int(input())
for i in range(N-1):
  neck = min(neck, int(input()))
res = math.ceil(N/neck)
print(res + 4)


### FIXED CODE ###

import math
N = int(input())
neck = int(input())
for i in range(4):
  neck = min(neck, int(input()))
res = math.ceil(N/neck)
print(res + 4)
n = input()
a = list(map(int, input().split()))
cnt=0
while all(i%2==0 for i in a) :
    a = [i/2 for in a]
    cnt += 1
print(cnt)

### FIXED CODE ###

n = input()
a = list(map(int, input().split()))
cnt = 0
while all(i%2==0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)
h,w=list(map(int,input().split()))
s=[input() for _ in range(h)]
g=[[] for _ in range(h*w)]

for i in range(w):
    for j in range(h):
        for di in [-1,0,1]:
            for dj in [-1,0,1]:
                if abs(di)+abs(dj)!=1:
                    continue
                if 0<=i+di<w and 0<=j+dj<h:
                    if s[j][i]!=s[j+dj][i+di]:
                        g[j*w+i].append(i+di+(j+dj)*w)

visit=[0]*(h*w)
ans=0
black=[0]*(h*w)
white=[0]*(h*w)

def rec(j,i,rj,ri):
    if s[j][i]=='#':
        black[rj*w+ri]+=1
    else:
        white[rj*w+ri]+=1
    
    for n in g[j*w+i]:
        if visit[n]==1:
            continue

        nj=n//w
        ni=n%w

        visit[n]=1

        rec(nj,ni,rj,ri)

for i in range(w):
    for j in range(h):
        if visit[w*j+i]:
            continue
        visit[w*j+i]=1

        if s[j][i]=='#':
            rec(j,i,j,i)
        else:
            rec(j,i,j,i)
        
        ans+=black[w*j+i]*white[w*j+i]

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(500*500)

h,w=list(map(int,input().split()))
s=[[1 if c=='#' else 0 for c in input()] for _ in range(h)]
g=[[] for _ in range(h*w)]

for i in range(w):
    for j in range(h):
        for di in [-1,0,1]:
            for dj in [-1,0,1]:
                if abs(di)+abs(dj)!=1:
                    continue
                if 0<=i+di<w and 0<=j+dj<h:
                    if s[j][i]!=s[j+dj][i+di]:
                        g[j*w+i].append(i+di+(j+dj)*w)

visit=[0]*(h*w)
black=[0]*(h*w)
white=[0]*(h*w)

def rec(j,i,rj,ri):
    if s[j][i]:
        black[rj*w+ri]+=1
    else:
        white[rj*w+ri]+=1
    
    for n in g[j*w+i]:
        if visit[n]:
            continue

        visit[n]=1

        rec(n//w,n%w,rj,ri)

ans=0

for i in range(w):
    for j in range(h):
        if visit[w*j+i]:
            continue
        visit[w*j+i]=1

        rec(j,i,j,i)
        
        ans+=black[w*j+i]*white[w*j+i]

print(ans)
from scipy.sparse.csgraph import dijkstra,floyd_warshall
from scipy.sparse import csr_matrix
from  itertools import permutations

N,M,R=map(int,input().split())
r=[int(x)-1 for x in input().split()]
A=[]
B=[]
C=[]
for i in range(M):
    x,y,z=map(int,input().split())
    A.append(x-1)
    B.append(y-1)
    C.append(z)

d=csr_matrix((C,(A,B)),shape=(N,N))
tr=floyd_warshall(d)

ans=float('inf')
for tmp in permutations(r):
    cnt=0
    for i in range(len(tmp)-1):
        cnt+=tr[tmp[i]][tmp[i+1]]
    ans=min(ans,cnt)

print(int(ans))



### FIXED CODE ###

from scipy.sparse.csgraph import dijkstra,floyd_warshall
from scipy.sparse import csr_matrix
from  itertools import permutations

N,M,R=map(int,input().split())
r=[int(x)-1 for x in input().split()]
dist=[[0 for _ in range(N)] for _ in range(N)]
for i in range(M):
    x,y,z=map(int,input().split())
    dist[x-1][y-1]=z
    dist[y-1][x-1]=z
tr=floyd_warshall(dist)
ans=10**12
for tmp in permutations(r):
    cnt=0
    for i in range(R-1):
        cnt+=tr[tmp[i]][tmp[i+1]]
    ans=min(ans,cnt)

print(int(ans))
f=open('in','r')
input=lambda:f.readline().strip()

n=int(input())
r=list(map(int,input().split()))
mod=1000000007
s=sum(r)%mod
x=0
for u in r:
  x+=u**2
x%=mod
t=500000004
print((s**2-x)*t%mod)

### FIXED CODE ###

# f=open('in','r')
# input=lambda:f.readline().strip()

n=int(input())
r=list(map(int,input().split()))
mod=1000000007
s=sum(r)%mod
x=0
for u in r:
  x+=u**2
x%=mod
t=500000004
print((s**2-x)*t%mod)
def main():
    from math import ceil
    from bisect import bisect_right
    N, D, A = map(int, input().split())
    Monsters = [list(map(int, input().split())) for i in range(N)]
    Monsters = sorted([[x, ceil(h / A)] for x, h in Monsters])


    class BIT2:
        """ 区間加算BIT(区間加算・区間合計取得) """

        def __init__(self, N):
            self.N = N
            self.data0 = [0] * N
            self.data1 = [0] * N

        def _add(self, data, k, x):
            while k < self.N:
                data[k] += x
                k += k & -k

        def _get(self, data, k):
            s = 0
            while k:
                s += data[k]
                k -= k & -k
            return s

        def add(self, l, r, x):
            """ 区間[l,r)に値xを追加 """

            self._add(self.data0, l, -x*(l-1))
            self._add(self.data0, r, x*(r-1))
            self._add(self.data1, l, x)
            self._add(self.data1, r, -x)

        def query(self, l, r):
            """ 区間[l,r)の和を取得 """

            return self._get(self.data1, r-1) * (r-1) + self._get(self.data0, r-1) \
                 - self._get(self.data1, l-1) * (l-1) - self._get(self.data0, l-1)


    RUQ = BIT2(2 * N)
    for i, (x, h) in enumerate(Monsters, start=1):
        RUQ.add(i, i + 1, h)


    i = 0
    ans = 0
    while i < N:
        cost = RUQ.query(i + 1, i + 2)
        if cost > 0:
            index = bisect_right(Monsters, [Monsters[i][0] + 2 * D, float('inf')])
            RUQ.add(i + 1, index + 1, -cost)
            ans += cost
        i += 1
        #
        # check = []
        # for j in range(1, N + 1):
        #     check.append(str(RUQ.query(j, j + 1)))
        # print(' '.join(check))

    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from math import ceil
H, A = map(int, input().split())
print(ceil(H / A))
from itertools import accumulate

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

cumsum = list(accumulate(lst))

mi = 2 * 10 ** 9
su = cumsum[-1]
for i in cumsum:
  mi = min(mi, abs(i - (su-i))
print(mi)

### FIXED CODE ###

from itertools import accumulate

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

cumsum = list(accumulate(lst))

mi = 2 * 10 ** 9
su = cumsum[-1]
for i in range(len(cumsum)-1):
  mi = min(mi, abs(cumsum[i] - (su-cumsum[i])))
print(mi)
import numpy as np

a = input()
index = []
index.append(a.find('?')+1)

i = 0
while a.find('?',index[i]) != -1:
  tmp = a.find('?',index[i])
  index.append(tmp + 1)
  i = i + 1

len = len(a)
cnt = 0
s = a[0]
if a[0] == 'D':
  cnt = cnt + 1

j = 1
while j < len:
  if a[j] == 'D':
    s = s + 'D'
    cnt = cnt + 1
    if s[j-1] == 'P':
      cnt = cnt + 1
  elif a[j] == '?':
    if j == 0:
      s = s + 'D'
      cnt = cnt + 1
    elif j > 0:
      if s[j-1] == 'P':
        s = s + 'D'
        cnt = cnt + 2
      elif s[j-1] == 'D' and j < len - 1:
        if a[j+1] == 'D' or a[j+1] == '?':
          s = s + 'P'
        else:
          s = s + 'D'
          cnt = cnt + 1
  elif a[j] == 'P':
    s = s + 'P'
  j = j + 1

print(s)


### FIXED CODE ###

a = input()
s = list(a)

for i in range(len(s)):
  if (a[i] == '?'):
    s[i] = 'D'

s = "".join(s)
print(s)
import math

if __name__ == '__main__':
    n =int(input())
    a = int(math.sqrt(n))

    print(a*

### FIXED CODE ###

import math

if __name__ == '__main__':
    n =int(input())
    a = int(math.sqrt(n))

    max=1
    for i in range(2,a+1):
        now = i*i
        while now <= n:
            if max < now:
                max =now
            now = now*i
    print(max)
# coding: utf-8

I, O, T, J, L, S, Z = [int(i) for i in input().split()]

K = (I//2)*2 + O + (J//2)*2 + (L//2)*2
if I % 2 == 1 and J % 2 == 1 and L % 2 ==1:
    K += 3
elif (I % 2 + J % 2 + L % 2 == 2) and (I * J * L > 0):
    K += 1
print(K)

### FIXED CODE ###

# coding: utf-8
# Here your code !

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

alist = []

if (y > x) and (y - x) >= 0:
    alist.append(y - x)

if y < x:
    alist.append(abs(abs(x)-abs(y))+2)
    
if (abs(x) < abs(y) and x >= 0 and y <= 0):
    alist.append(abs(y)-abs(x)+1)

if (abs(x) > abs(y) and x <= 0 and y >= 0):
    alist.append(abs(x)-abs(y)+1)

if (abs(x) < abs(y) and x <= 0 and y >= 0):
    alist.append(abs(y) - abs(x) + 1)

if (abs(x) > abs(y) and x >= 0 and y <= 0):
    alist.append(abs(x) - abs(y) + 1)

if (abs(x) == abs(y)):
    alist.append(1)
    
print(min(alist))
d,g = map(int,input().split())
po = [0]
co = [0]
for i in range(d):
    p,c = map(int,input().split())
    po.append(p)
    co.append(c)

# f(g,i) :　残りG点で、i番目の問題を最大いくつ選べるか
# i番目の問題をn問解いて、
# その得点sがGより小さかったら、f(G-s,i-1)をnに加える。
# ここでiをデクリメントするのは、完全に解く問題より高い得点の問題を
# 中途半端に解くことが最適な問題の選び方ではないため。
# i == 0 の時は float('inf') を返す。（解けない場合）
def f(G,i):
    if i == 0:
        return float("inf")
    n = min(G//(i * 100),p[i])
    s = 100 * i * n 
    if n == p[i]:
        s += c[i]
    if s < G:
        n += f(G-s,i-1)
    return min(n,f(G,i-1))

print(f(g,d))

### FIXED CODE ###

d,g = map(int,input().split())
po = [0]
co = [0]
for i in range(d):
    p,c = map(int,input().split())
    po.append(p)
    co.append(c)

# f(g,i) :　残りG点で、i番目の問題を最大いくつ選べるか
# i番目の問題をn問解いて、
# その得点sがGより小さかったら、f(G-s,i-1)をnに加える。
# ここでiをデクリメントするのは、完全に解く問題より高い得点の問題を
# 中途半端に解くことが最適な問題の選び方ではないため。
# i == 0 の時は float('inf') を返す。（解けない場合）
def f(G,i):
    if i == 0:
        return float("inf")
    n = min(G//(i * 100),po[i])
    s = 100 * i * n 
    if n == po[i]:
        s += co[i]
    if s < G:
        n += f(G-s,i-1)
    return min(n,f(G,i-1))

print(f(g,d))
h, w = map(int, input().split())
a = [input() for _ in range(h)]

row = [False] * h
col = [False] * w
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            row[i] = True
            col[i] = True
for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end = "")
        print()

### FIXED CODE ###

h, w = map(int, input().split())
a = [input() for _ in range(h)]

row = [False] * h
col = [False] * w
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            row[i] = True
            col[j] = True
for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end = "")
        print()
N=int(input())
if N%2==0:
  print((N/2)**2)
else:
  print((N//2)*(N-(N//2))

### FIXED CODE ###

N=int(input())
if N%2==0:
  print((N//2)**2)
elif N%2!=0:
  print((N//2)*(N-(N//2)))
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(int(p**(1/n))+2,1,-1):
        if p%i**n==0:
            res=i
            break
print(res)

### FIXED CODE ###

s = input()

cnt=0
for c in s:
    if c =="2":
        cnt+=1
print(cnt)
N=int(input())
t=[[int(x) for x in input().split()] for i in range(0,N)]

def func(N,t):
    if (t[0][0]-(t[0][1]+t[0][2]))%2==1 or t[0][0]-(t[0][1]+t[0][2])<0 : return "No"
    
    for i in range(1,N):
        if ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))%2==1 and ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))<0 : return "No"
    
    return "Yes"
    
print(func(N,t))

### FIXED CODE ###

a,b = [int(x) for x in input().split()]

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


### FIXED CODE ###

h,a = map(int,input().split())
if h % a == 0:
  print(h//a)
else:
  print(h//a+1)
if __name__ == "__main__":
	while True:
		score = [int(i) for i in input().split()]
		if score[0] == score[1] == score[2] == -1:
			break
		if score[0] == -1 or score[1] == -1:
			print ('F')
		else:
			if score[0] + score[1] >= 80:
				print ('A')
			elif score[0] + score[1] >= 65:
				print ('B')
			elif score[0] + score[1] >= 50:
				print ('C')
			elif score[0] + score[1] >= 30:
				if score[2] == -1:
					print ('D')
				else:
					if score[2] >= '50':
						print ('C')
					else:
						print ('D')
			else:
				print ('F')

### FIXED CODE ###


if __name__ == "__main__":
	while True:
		score = [int(i) for i in input().split()]
		if score[0] == score[1] == score[2] == -1:
			break
		if score[0] == -1 or score[1] == -1:
			print ('F')
		else:
			if score[0] + score[1] >= 80:
				print ('A')
			elif score[0] + score[1] >= 65:
				print ('B')
			elif score[0] + score[1] >= 50:
				print ('C')
			elif score[0] + score[1] >= 30:
				if score[2] == -1:
					print ('D')
				else:
					if score[2] >= 50:
						print ('C')
					else:
						print ('D')
			else:
				print ('F')
for e in sys.stdin:
    a, b, c = sorted(map(int, e.split()))
    if a**2 + b**2 == c**2:
        print('YES')
    else:
        print('NO')


### FIXED CODE ###

import sys
input()
for e in sys.stdin:
    a, b, c = sorted(map(int, e.split()))
    if a**2 + b**2 == c**2:
        print('YES')
    else:
        print('NO')
1 s = input().rstrip()
2 print('x' * len(s))

### FIXED CODE ###

s = input()
print("x" * len(s))
a = list(input())
b = list(input())

a.sort()
b.sort(reverse=True)


for i in range(int(len(b))):
    c =(a[i],b[i])
    d = sorted(c)
    if i != int(len(b))-1:
        if a[i] == b[i]:
            continue
        elif c == d and a[i] != b[i]:
            print("No")
            break
        else:
            print("Yes")
            break
    if i == int(len(b))-1:
        if a[i] == b[i]:
            if int(len(a)) >= int(len(b)):
                print("No")
            else:
                print("Yes")
        elif c == d and a[i] != b[i]:
            print("No")
            break
        else:
            print("Yes")
            break


### FIXED CODE ###

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

c = a + b

if c % 2 == 0:
    print(int(c / 2))
else:
    print(int(int(c / 2) + 1))
import itertools^M
N,K = list(map(int, input().split(" ")))^M
A = list(itertools.chain.from_iterable([input().split(" ")  for i in range(K) if input().split(" ")]))^M
A = list(map(int, A))
none = [a for a in range(1, K + 1) if a not in A]
print(len(none))

### FIXED CODE ###

import itertools

inp2intlist = lambda inp:list(map(int,inp))

N,K = list(map(int, input().split(" ")))
A = list(itertools.chain.from_iterable([inp2intlist(input().split())  for i in range(K) if input().split()]))

print(N - len(set(A)))
data = input().split()

n = int(data[0])
m = int(data[1])

pro = [int(s) for s in input().split()]

vote = 0
for i in pro:
  vote += i

pro.sort(reverse=true)

if pro[m - 1] < 1 / (4 * vote):
  print("No")
else:
  print("Yes")


### FIXED CODE ###

data = input().split()
 
n = int(data[0])
m = int(data[1])
 
pro = [int(s) for s in input().split()]
 
vote = 0
for i in pro:
  vote += i
 
s_pro = sorted(pro, reverse=True)

if s_pro[m - 1] < vote * 1 / (4 * m):
  print("No")
else:
  print("Yes")
n, k = map(int, input().split())
a = list(map(int, input().split()))

a.sort(key=lambda x:-x)

# パワーがi以上の人の数
s = [0 for _ in range(2*a[0]+1)]
for p in a:
    s[p] += 1
for i in range(2*a[0], 0, -1):
    s[i-1] += s[i]

def is_over(x):
    num = 0
    for p in a:
        num += s[max(x-p, 0)]
    return num >= k

ub = 2*a[0]
lb = 2*a[-1]
while ub-lb > 1:
    x = (ub+lb)//2
    if is_over(x):
        lb = x
    else:
        ub = x

# a[0]からa[i]の累積和
t = a[:]
for i in range(1, n):
    t[i] += t[i-1]
ans = 0
for p in a:
    # 左手固定
    u = s[max(x-p, 0)] # 握手すると閾値を超えるひとたち
    if u != 0:
        ans += p*u+t[u-1] # 1人目pとu回握手 + 右手はu人までと握手
        k -= u
ans += lb*k # 閾値上の人の処理
print(ans)


### FIXED CODE ###

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

A.sort(reverse=True)
LB = A[-1] * 2  # 一回の握手で上がる幸福度の下限は、左手も右手もパワーが一番低い人を握った場合
UB = A[0] * 2   # 一回の握手で上がる幸福度の上限は、左手も右手もパワーが一番高い人を握った場合

# cgs[i] は パワーがi以上のゲストの数
cgs = [0] * (UB + 1)
for a in A:
    cgs[a] += 1
for i in range(UB, 0, -1):
    cgs[i - 1] += cgs[i]


# 組み合わせの数がM以上になる一回で発生する幸福度の閾値を二分探索する
def is_ok(n):
    m = 0
    for a in A:
        m += cgs[max(n - a, 0)]
    return m >= M


ok = LB
ng = UB + 1
while ng - ok > 1:
    m = (ok + ng) // 2
    if is_ok(m):
        ok = m
    else:
        ng = m

# cps[i] は A[0]～A[i] の累積和
cps = A[:]
for i in range(1, N):
    cps[i] += cps[i - 1]

result = 0
for a in A:
# 左手固定
    t = cgs[max(ok - a, 0)] # 握手すると閾値を超えるひとたち
    if t != 0:
        result += a * t + cps[t - 1] # 1人目pとu回握手 + 右手はu人までと握手
        M -= t
result += ok * M # 閾値上の人の処理
print(result)
s = input()
print(s.rfind("Z") - s.fine("A") + 1)

### FIXED CODE ###

s = input()
print(len(s) - s[::-1].find("Z") - s.find("A"))