peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys
import math

read = sys.stdin.read
readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = int(input())
    x1 = math.ceil(S ** 0.5)
    x2 = x1 ** 2 - S
    print(0, 0, x1, 1, x2, x1)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
a = int(input())
xy = [map(int, input().split()) for _ in range(a)]
x, y = [list(i) for i in zip(*xy)]
flag = 0
for i in range(a):
    if (x[i] == y[i]):
      flag = flag+1
    else:
      flag = 0
if flag >= 3:
    print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import sys
import math

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N = ii()
    A = list(mi())
    s = sum(A[i]-i-1 for i in range(N))/N
    print(sum(abs(A[i]-i-1-math.floor(s)) for i in range(N)))


if __name__ == '__main__':
    main()
# Judge status: Accepted
n, a, b = map(int,input().split())
s_list = list(input())
judge=[]
count_tot = 0
count_inter = 0

for s in s_list:
    if s == 'a':
        if count_tot < a+b:
            judge.append('Yes')
            count_tot += 1
            continue
    elif s == 'b':
        if count_tot < a+b and count_inter < b:
            judge.append('Yes')
            count_tot += 1
            count_inter += 1
            continue
    judge.append('No')

for result in judge:
    print(result)
# Judge status: Accepted
N, Y = map(int,input().split())
x, y, z = -1, -1, -1
k = 0
for i in range(N+1):
    for j in range(0,N-i+1):
        k = N - i - j
        if 10000*i + 5000*j + 1000*k == Y :
            x, y, z = i, j, k
            break
print(x, y, z)
# Judge status: Accepted
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))

import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

result=1
for num in S:
    result = lcm(result,num)
print(result)
# Judge status: Wrong Answer
N, M = map(int, input().split())
S = []
for i in range(N):
  a, b = map(int, input().split())
  S.append([a, b])

S.sort(key=lambda x: x[0])
ans = 0
for s in S:
  if ans + s[0] * s[1] < M:
    ans += s[0] * s[1]
  else:
    q = (M - ans + s[0] - 1) // s[0]
    ans += s[0] * q
    break

print(ans)
# Judge status: Wrong Answer
import math
N,A,B = map(int,input().split())
c = N%(A+B)
p = math.floor(N/(A+B))
print((A*p)+c)
# Judge status: Wrong Answer
l = [list(map(int,input().split())) for i in range(3)]
ans = 0
for i in l:
  ans += sum(i)
print("Yes" if ans%3==(l[0][0]+l[1][1]+l[2][2]) else "No")
# Judge status: Accepted
x,y,z=map(int,input().split())
count=1
x -= 2*z+y
count += x //(y+z)
print(count)
# Judge status: Wrong Answer
A= [i for i in input()]
while True:
    A.pop()
    A.pop()
    B=len(A)//2
    if A[:B]==A[B+1:]:
        print(len(A))
        break
# Judge status: Accepted
S = input()
s = S
for i in range(len(S)):
    s = s[:-1]
    if s[:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        exit()
# Judge status: Accepted
import math

A, B, H, M = map(int, input().split())

degree = abs((H * 60 + M) / 2 - M * 6)

d = A**2 + B**2 - 2 * A * B * math.cos(math.radians(degree))
ans = d**0.5

print(ans)
# Judge status: Accepted
from collections import deque

s = deque(input())
q = int(input())
flip = 0
for _ in range(q):
    com, *query = input().split()
    if com == "1":
        flip ^= 1
    else:
        f, c = query
        f = int(f)-1
        if f ^ flip == 1:
            s.append(c)
        else:
            s.appendleft(c)
s = "".join(s)
print(s if not flip else s[::-1])
# Judge status: Wrong Answer

D=[]
for i in range(int(input())):
    INPUT = [(j) for j in input().split()]
    D.append([INPUT[0],INPUT[1],i+1])
D.sort(key=lambda x:x[1],reverse=True)
D.sort(key=lambda x:x[0])
for d in D:
    print(d[2])
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline


n = int(input())

tank = []
dg = 10**10
mi = []
ma = []

for _ in range(n):
    a,b = map(int,input().split())
    tank.append(a*dg + b)
    mi.append(a)
    ma.append(b)

mi.sort()
ma.sort(reverse = True)

if n % 2 == 1:
    c = mi[n//2]
    d = ma[n//2]
    print(d-c+1)
else:

    c = (mi[(n//2) - 1] + mi[n//2])
    d = (ma[(n//2) - 1] + ma[n//2])

    print(d-c+1)
# Judge status: Accepted
n = int(input())

lst1 = list(map(int,input().split()))

amount = 0
sub = 0
for i in lst1:
    if i%4 == 0:
        amount += 1
    elif i%2 == 0:
        sub += 1

if amount + sub//2 >= len(lst1)//2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
N = int(input())
A = list(map(int, input().split()))
i = 0
cnt = 0
while i < N:
    while i < N - 1 and A[i + 1] == A[i]:
        i += 1
    if i >= N - 1:
        cnt += 1
        print(cnt)
        sys.exit()
    if A[i + 1] < A[i]:
        while i < N - 1 and A[i + 1] <= A[i]:
            i += 1
    else:
        while i < N - 1 and A[i + 1] >= A[i]:
            i += 1
    cnt += 1
    i += 1
print(cnt)
# Judge status: Accepted
data = [int(i) for i in input().split(" ")]
print(len(set(data)))
# Judge status: Wrong Answer
K, X = map(int, input().split())
print([i for i in range(X-K+1, X+K)])
# Judge status: Wrong Answer
import collections

s = input()

c = collections.Counter(s)

if len(c) == 1:
  print("Yes")
elif len(c) == 2:
  if (list(c.values())[0] == 1) | (list(c.values())[0] == 3):
    print("Yes")
  else:
    print("No")
else:
  print("No")
# Judge status: Wrong Answer
N = input()
for n in N:
    if N.count(n) >= 3:
        print('Yes')
else:
    print('No')
# Judge status: Accepted
a,b=list(map(int,input().split()))
l=['1','2','3','4','5','6','7','8','9','0']
s=input()
if len(s)!=a+b+1:
    print("No")
    exit()
for i in range(a+b+1):
    if i==a:
        if s[a]!='-':
            print("No")
            exit()
        else:
            continue
    if s[i] not in l:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
def main():
    s = input()
    s_l = len(s)
    cnt = 0
    for i in range(s_l//2):
        if s[i] != s[::-1][i]:
        # if s[i] != s[s_l-i-1]:
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
from math import sqrt

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

ab = a*b
bc = b*c
ca = c*a

if 2*(ab+bc+ca) < a**2 + b**2 + c**2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
lastd = [0] * 26

for i in range(1, d + 1):
    ans = 0
    tmp = 0
    for j in range(26):
        if tmp < s[i - 1][j] + (i - lastd[j]) * c[j]:
            tmp = s[i - 1][j] + (i - lastd[j]) * c[j]
            ans = j + 1
    lastd[ans - 1] = i
    print(ans)
# Judge status: Wrong Answer
n,m = map(int, input().split())
s = list(input())
abc = ['a','b','c']

s[m-1] = abc[m % 3 - 1]

print(*s, sep='')
# Judge status: Accepted
#!/usr/bin/env python3

N, L = map(int, input().split())
S = sorted([input() for i in range(N)])

print(''.join(S))
# Judge status: Accepted
import sys
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
if N == 1:
    print('0')
    sys.exit()
for i in range(min(X), max(X) + 1):
    ans = 0
    for j in X:
        ans += (j - i) ** 2
    ans_list.append(ans)

print(min(ans_list))
# Judge status: Accepted
n = int(input().strip())
if n == 1:
    print(1)
elif 2 <= n < 4:
    print(2)
elif 4 <= n < 8:
    print(4)
elif 8 <= n < 16:
    print(8)
elif 16 <= n < 32:
    print(16)
elif 32 <= n < 64:
    print(32)
elif 64 <= n <= 100:
    print(64)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count_a = 0
count_b = 0
for i in range(n):
    count_a += max(0,(b[i]-a[i]+1)//2)
    count_b += max(0,a[i]-b[i])
if sum(b)>=sum(a) and sum(b)-sum(a)>=max(count_a,count_b):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
A=list(map(int,input().split()))
def gcd(a, b):
    while(b != 0):
        a, b = b, a % b
    return a
    
def lcm(m,n):
    return (m*n)//gcd(m,n)
for ai in A:
    pro=lcm(pro,ai)
for ai in A:
    count+=pro//ai
print(count%mod)
# Judge status: Wrong Answer
N = int(input())
ans = 0
for j in range(1,N+1):
    num = int(N/j)
    ans += num*(num-1)/2*j
print(int(ans))
# Judge status: Accepted
from string import ascii_uppercase
x = input()
print('A' if x in ascii_uppercase else 'a')
# Judge status: Accepted
h,a=map(int, input().split())
print((h-1)//a+1)
# Judge status: Wrong Answer
s = input("Enter Input:")

if s[len(s) -  1] != "s":
    s += "s"

elif s[len(s) - 1] == "s":
    s += "es"

print(s)
# Judge status: Wrong Answer
w = input()
lower = w.lower()
if w == lower:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10**18:
            print(-1)
            break
    else:
        print(ans)
# Judge status: Accepted
INFTY = 10**9

N, K = map(int, input().split())
H = list(map(int, input().split()))

dp = [INFTY] * N
dp[0] = 0
for i in range(1,N):
    j = 1
    while j <= K and i-j >= 0:
        dp[i] = min(dp[i], dp[i-j]+abs(H[i-j]-H[i]))
        j += 1

print(dp[N-1])
# Judge status: Accepted
N=int(input())
CSF=[list(map(int,input().split())) for _ in range(1,N)]
for i,csf in enumerate(CSF):
    c,s,f=csf[0],csf[1],csf[2]
    ans=c+s
    for j in range(i+1,N-1):
        csf_=CSF[j]
        c_,s_,f_=csf_[0],csf_[1],csf_[2]
        if ans<s_:
            ans=s_
        elif ans%f_!=0:
            ans=ans+f_-ans%f_
        ans+=c_
    print(ans)
print(0)
# Judge status: Wrong Answer
import numpy as np

n = int(input())
xy = np.array([list(map(int,input().split())) for _ in range(n)],int)

x = xy[:,0]
y = xy[:,0]

a = x+y
b = -x+y

ans = max(a.max() - a.min(), b.max()-b.min())
print(ans)
# Judge status: Accepted
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))

# 株は変えるだけ買うほうがよさそう
dp = defaultdict(int)
dp[0] = 1000
for a in A:
    key, val = zip(*dp.items())
    for k, v in zip(key, val):
        # 株売る
        dp[0] = max(dp[0], v + k * a)
        # 株買う
        buy = v // a
        dp[k + buy] = max(dp[k + buy], v - buy * a)

print(dp[0])
# Judge status: Wrong Answer
a=list(map(int,input().split()))

if a[2]>=a[0] and a[2]<=a[1]:
  print('YES')
  
else:
  print('NO')
# Judge status: Accepted

H,W = map(int,input().split())
if min(H,W)==1:
    print(1)
else:
    print((H*W+1)//2)
# Judge status: Wrong Answer
N, M = map(int, input().split())

a_lis = [0]*M
b_lis = [0]*M

for i in range(M):
    a_lis[i], b_lis[i] = map(int, input().split())


new_lis = a_lis + b_lis
set_new_lis = sorted(set(new_lis))
set_new_lis

for i in set_new_lis:
    print(new_lis.count(i))
# Judge status: Wrong Answer
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

i = 0
l = len(A)
n = 1


while True:

    i = A[i] - 1
    n += 1
    if A[i] == 2:
        print(n)
        break

    if n == l:
        print(-1)
        break
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

T = LS2()

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

ans = ''
for i in range(len(T)):
    ans += T[i]

print(ans)
# Judge status: Accepted
s = list(input())
ans = [0]*(len(s)+1)
for i in range(len(s)) :
    if s[i] == '<' :
        ans[i+1] = ans[i]+1 
for i in range(len(s),0,-1) :
    if s[i-1] == '>' :
        ans[i-1] = max(ans[i-1],ans[i]+1)
print(sum(ans))
# Judge status: Accepted
import math

n=input()
for i in range(0,2):
    if(n[i]=="9"):
        print("Yes")
        exit()
print("No")
# Judge status: Wrong Answer
"""
author : halo2halo
date : 31, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
S = readline().decode('utf8')

ans = 0
cnt=0
for i in S:
    
    if i == 'I':
        cnt += 1
    else:
        cnt -= 1

    ans=max(ans, cnt)
# Judge status: Accepted
n=int(input())
zmi=wmi=int(1e+10)
zma=wma=int(-1e+10)
for i in range(n):
    xi,yi=map(int,input().split())
    zma=max(xi+yi,zma)
    wma=max(xi-yi,wma)
    zmi=min(xi+yi,zmi)
    wmi=min(xi-yi,wmi)
print(max(zma-zmi,wma-wmi))
# Judge status: Accepted
s = input().replace("AtCoder ","").replace(" Contest","")
print("A" + s[0] + "C")
# Judge status: Wrong Answer
S=input()
T=input()
if (S in T):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import fractions

A,B,K=map(int,input().split())

base=fractions.gcd(A,B)
answers=[]

for i in range(1,base+1):
    if base%i==0:
        answers.append(i)
print(answers[-K])
# Judge status: Accepted
import math
x = int(input())
k = 100
ans = 0

while k < x:
  ans += 1
  k = math.floor(k * 101/100)
print(ans)
# Judge status: Accepted
s=input()
t=input()
ans=0
for i in range(len(s)):
    s=s[1:]+s[0]
    if s==t:
        ans+=1
if ans:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a, b, c = map( int, input().split())

if a == b+c or a + b == c or a + c == b:
  print('Yes')
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

antenas=[a,b,c,d,e]
teste = 1

for i in range(len(antenas)):
    for j in range(len(antenas)):
        if antenas[j]-antenas[i] > k:
            teste = 0
            break
if teste:
    print("Yay!")
else:
    print(":(")
# Judge status: Accepted
# -*- coding: utf-8 -*-
a,b,k = map(int,input().split())

ans = []
for i in range(1, min(a, b) + 1):
    if a % i == 0 and b % i == 0:
        ans.append(i)
ans.sort()
print(ans[len(ans) - k])
# Judge status: Wrong Answer
from collections import deque
import heapq

x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
lis = p[len(p)-x:] + q[len(q)-y:] + r
lis = sorted(lis)
print(sum(lis[len(r):]))
# Judge status: Accepted
X = int(input())
v = 100
for i in range(1, 3761):
    v *= 1.01
    v = int(v)
    if v>=X:
        print(i)
        break
# Judge status: Accepted
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = []
C = []
for i, a in enumerate(A):
  B.append(i+1+a)
  C.append(i+1-a)
cb = Counter(B)
cc = Counter(C)
ans = 0
for k, v in cb.items():
  ans += v*cc[k]
print(ans)
# Judge status: Wrong Answer
print('室温(-40℃から40℃まで)を整数値で入力してください。')
X = int(input())
if X>=30:
 print('yes')
else:
 print('no')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A_rev = sorted(A, reverse=True)
print(sum(A_rev[:-1]))
# Judge status: Wrong Answer
n=int(input())
B=list(map(int,input().split()))
B.append(float('inf'))
A=[min(B[i],B[i+1]) for i in range(n-1)]
print(sum(A))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in range(N):
    a=min(A[i],B[i])
    B[i]-=a
    b=min(A[i+1],B[i])
    A[i+1]-=b
    ans+=a+b
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**9
  
for i in range(n-k+1):
  if x[k-1+i]*x[i] < 0:
    if x[k-1+i] <= abs(x[i]) :
      temp = 2*x[k-1+i] - x[i]
    elif abs(x[i]) < x[k-1+i]:
      temp = x[k-1+i] - 2*x[i]
      
  elif (0 <= x[i]):
    temp = x[k+i-1]

  elif (x[k+i-1] <= 0):
    temp = -x[i]
    
  if temp < ans:
    ans = temp
    
print(ans)
# Judge status: Accepted
A,B,C=map(int,input().split())
if C-(A-B)<0:
  print(0)
else:
  print(C-(A-B))
# Judge status: Accepted
import math
H,N = map(int, input().split())
A = list(map(int, input().split()))

if sum(A) >= H:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))

for i in range(n-1):
    if h[i] - h[i+1] < 0:
        h[i+1] -= 1
    if h[i] - h[i+1] > 0:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[1]:


S = input()
T = input()


# In[4]:


for i in range(len(S)):
    tmp = S[i:] + S[:i]
    if tmp == T:
        print("Yes")
        break
else:
    print("No")


# In[ ]:
# Judge status: Accepted
from collections import Counter
n=int(input())
l=[input() for i in range(n)]
c=Counter(l)
print(len(c))
# Judge status: Accepted
import sys
import math
import itertools

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

l.sort(reverse=True)
max=l.pop(0)
for i in range(len(l)-1):
	l[i+1]=l[i]+l[i+1]

if max<l[-1]:
	print("Yes")
else :
	print("No")
# Judge status: Wrong Answer
S=input()
if (S=="RRS" or S=="SRR"):
    print (2)
elif S=="RRR":
    print (3)
else:
    print (0)
# Judge status: Wrong Answer
a=int(input())
b=int(input())
for i in range(4):
	if i!=a and i!=b:
		print(i)
# Judge status: Accepted
a = int(input())
s = input()

print(s if a >= 3200 else 'red')
# Judge status: Accepted
*a,=map(int,[*open(s:=0)][1].split())
c=sum(a)
b=1
for a in a:
  if b<a:
    s=-1
    break
  s+=b
  c-=a
  b=min(c,(b-a)*2)
print(s)
# Judge status: Accepted
N,M,X=map(int,input().split())
ls=[list(map(int,input().split())) for i in range(N)]
ls_c=[]
for i in range(1,2**N):
  ls_al=[0]*M
  c=0
  for j in range(N):
    if (i>>j)&1==1:
      c+=ls[j][0]
      for k in range(M):
        ls_al[k]+=ls[j][k+1]
  if min(ls_al)>=X:
    ls_c.append(c)
    
if ls_c!=[]:
  print(min(ls_c))
else:
  print(-1)
# Judge status: Accepted
s = input()
result = ''
for i in range(len(s)):
    if s[i] == '0':
        result += '0'
    elif s[i] == 'B':
        if result != '':
            result = result[:-1]
    else:
        result += '1'
print(result)
# Judge status: Accepted
n = int(input())
ans = 0
tmp = 0
for i in range(n):
    k = int(input())
    if k:
        tmp += k
    else:
        ans += tmp // 2
        tmp = 0
print(ans + tmp // 2)
# Judge status: Wrong Answer
H, N = map(int,input().split())
special_move = list(map(int,input().split()))

if H < sum(special_move):
    result = 'Yes'
else:
    result = 'No'

print(result)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a // 3 > 0 or b // 3 > 0 or (a + b) // 3 > 0:
    print("Possible")
else:
    print("Impossible")
# Judge status: Wrong Answer
N=int(input())

for i in range(N,999):
    n=str(i)
    if all(x==n[0] for x in n):
        print(n)
        break
# Judge status: Accepted
import math
a, b, x = map(int, input().split())
if a ** 2 * b / 2 <= x:
  theta = math.atan(2 * b / a - 2 * x / (a ** 3))
else:
  theta = math.pi / 2 - math.atan(2 * x / (a * b * b))
print(math.degrees(theta))
# Judge status: Accepted
N, *A = map(int, open(0).read().split())

s = sum(A)

ans = 1
cur = 1
for a in A:
    s -= a

    if (cur := min(2 * (cur - a), s)) < 0:
        print(-1)
        quit()

    ans += cur

print(ans)
# Judge status: Accepted
import random
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
for i in range(D):
    print(S[i].index(max(S[i]))+1)
# Judge status: Accepted
n,k=map(int,input().split())
x=list(map(int,input().split()))
ans=10**18
for i in range(n-k+1):
  l=x[i]
  r=x[i+k-1]
  ans=min(ans,min(abs(l)+abs(r-l),abs(r)+abs(l-r)))
print(ans)
# Judge status: Accepted
a = [int(input()) for i in range(5)]

mn = a[0] % 10
for i in a:
    if i % 10 == 0:
        continue
    mn = min(mn, i % 10)

for i in a:
    if i % 10 == mn:
        mn = i
        break


ans = 0
for i in a:
    if i == mn:
        ans += i
        mn = -1
        continue
    t = ((i + 9) // 10) * 10
    ans += t

print(ans)
# Judge status: Wrong Answer
import math

n, d = map(int, input().split())
x = [list(map(int, input().split()))for _ in range(n)]
cnt = 0
for i in range(n-1):
    for j in range(i+1,n-1):
        s = 0
        for k in range(d):
            s += (x[i][k] - x[j][k])**2
        if math.sqrt(s) % 1 == 0:
            cnt += 1
print(cnt)
# Judge status: Wrong Answer
# A - Candy Distribution Again
count = 0
N, x = map(int, input().split())
A = input().split()
A.sort()
A_i = [int(s) for s in A]
if(sum(A_i) == x):
    print(N)
else:
    for i in range(N):
        if(i != N-1):
            x -= A_i[i]
            if(x >= 0):
                count += 1
    print(count)
# Judge status: Accepted
import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

n = r()
a = rl()
ans = 0
a.sort()
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if a[i]!=a[j] and a[j]!=a[k] and a[k]!=a[i] and a[i]+a[j]>a[k]:
                ans+=1
print(ans)
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))
A.sort()
B = [0]*(A[-1]+1)
ans = 0
for i,a in enumerate(A):
    if B[a]:
        continue
    else:
        if i+1 == n or A[i+1] != a:
            ans += 1
        x = a
        while x <= A[-1]:
            B[x] = 1
            x += a
print(ans)
# Judge status: Accepted
a = list(input())
b = list(input())
c = list(input())
next = a.pop(0)
while True:
  if next == "a":
    if a == []:
      print("A")
      break
    else:
      next = a.pop(0)
  elif next == "b":
    if b == []:
      print("B")
      break
    else:
      next = b.pop(0)
  else:
    if c == []:
      print("C")
      break
    else:
      next =c.pop(0)
# Judge status: Accepted
N = int(input())
S = []

for i in range(N):
    s = int(input())
    S.append(s)

a = sum(S)
ans = 0

if a % 10 != 0:
    ans = a
else:
    T = [s for s in S if s%10!=0]
    if len(T) == 0:
       ans = 0
    else:
        ans = a-min(T)

print(ans)
# Judge status: Accepted
from collections import Counter
N=int(input())
A=Counter(sorted(list(map(int,input().split()))))
A=[[i,A[i]] for i in A if A[i]>=2]
A.sort(reverse=True)
try:
    if A[0][1]>=4:
        print(A[0][0]**2)
    else:
        print(A[0][0]*A[1][0])
except:
    print(0)
# Judge status: Accepted
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if abs(A - B) <= (V - W) * T:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n, k = list(map(int,input().split()))
h = sorted(list(map(int,input().split())),reverse = True)
h = h[k:]
if n >= k:
    print(sum(h))
else:
    print(0)
# Judge status: Wrong Answer
S = input()

Z = []
X = len(S)

i = 0
while i  < X :
    if S[i] == "0":
        Z.insert(0,0)
    elif S[i] == "1":
        Z.insert(0,1)
    elif S[i] == "B":
        if len(Z)== 0:
            pass
        else:
            Z.pop(0)
    i += 1

i = 0
X = len(Z)
while i < X:
    print(Z[i] , end ="")
    i +=1
# Judge status: Accepted
A, B = map(int, input().split())

if A > 9 or B > 9:
    print(-1)
else:
    print(A*B)
# Judge status: Accepted
data=list(map(int,input().split()))
if data[0]/data[1]<=data[2]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def main():
    n = int(input())
    s = input()

    ans = -float("inf")
    for i in range(1, n):
        s_union = set(s[:i]) & set(s[i:])
        ans = max(ans, len(s_union))
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
a, b, c = map(int, input().strip().split())

count = 0

while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    if a == b and b == c:
        count = -1
        break

    count += 1
    a1 = b // 2 + c // 2
    b1 = c // 2 + a // 2
    c1 = a // 2 + b // 2

    a, b, c = a1, b1, c1

print(count)
# Judge status: Accepted
a,b,n = list(map(int, input().split()))
if n>=b-1:
    res = (a*(b-1))//b-a*((b-1)//b)
else:
    res = (a*n)//b
print(res)