peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n+1)
for i in range(n,0,-1):
    temp=0
    for j in range(i,n+1,i): temp+=ans[j]
    if a[i-1]!=temp%2: ans[i]=1
print(sum(ans))           
for i in range(n):
    if ans[i]==1: print(i,end=" ")
# Judge status: Wrong Answer
if int(input())>= 3200:
  print("red")
else:
  print(input())
# Judge status: Accepted
s = input()
p = int(input())

dir = 0
mae = []
usi = []

for _ in range(p):
  Q = input().split()
  if Q[0] == "1":
    dir = not dir
  else:
    if (int(Q[1]) - 1) == dir:
      mae.append(Q[2])
    else:
      usi.append(Q[2])
      
ans = "".join(mae[::-1]) + s + "".join(usi)
      
if not dir:
  print(ans)
else:
  print(ans[::-1])
# Judge status: Accepted
import math
a,b,x=map(int,input().split())
S=x/a
if S<=a*b/2:
    h=2*S/b
    answer=math.degrees(math.atan(b/h))
    print(answer)
else:
    T=a*b-S
    h=2*T/a
    answer=math.degrees(math.atan(h/a))
    print(answer)
# Judge status: Wrong Answer
n = list(str(input()))
flag = True 
for i in range(len(n)):
  if n[i] == '7':
    print('YES')
    flag = False 
    break
if flag:
  print('NO')
# Judge status: Accepted
t="abcdefghijklmnopqrstuvwxyz"
s=input()
k=int(input())
a=[t.index(i)for i in s]
ans=""
for i in a:
  j=i
  if i==0:
    ans+="a"
    continue
  if k>=26-i:
    k-=26-i
    j=0
  ans+=t[j]
j+=k
j%=26
ans=ans[:-1]+t[j]
print(ans)
# Judge status: Accepted
D = int(input())
if D == 25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
else:
    print('Christmas Eve Eve Eve')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

b=[0,0,0]
for i in a:
  if i % 4==0:
    b[0]+=1
  elif i % 2==0:
    b[1]+=1
  else:
    b[2]+=1
if b[2]<=b[0]:
  print("Yes")
elif b[2]-1==b[0] and b[1]==0:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n=int(input())
I=list(map(int,input().split()))
num=1000
for i in range(n-1):
    if I[i]<I[i+1]:
        num-=(num//I[i])*I[i]
        num+=(num//I[i])*I[i+1]

print(num)
# Judge status: Wrong Answer
N = int(input())
cs = []
t1, x1, y1 = 0, 0, 0
ans = 'Yes'
for i in range(N):
  t2, x2, y2 = map(int, input().split())
  d = abs(x1-x2) + abs(y1+y2)
  if d > (t2 - t1) or d % (t2 - t1):
    ans = 'No'
print(ans)
# Judge status: Accepted
from collections import deque

n = int(input())
list = [list(map(int,input().split())) for i in range(n)]

p = []
for i in list:
  p.append([i[0] - i[1],i[0] + i[1]])
  
p = sorted(p,key = lambda x: x[1])

p = deque(p)
ex = []
ex.append(p.popleft())




for i in range(len(p)):
  if(ex[-1][1] <= p[0][0]):
    ex.append(p.popleft())
  else:
    p.popleft()

print(len(ex))
# Judge status: Wrong Answer
import sys
import math
sys.setrecursionlimit(int(1e6))

n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
#print('n, k = ', n, k)
#print('A = ', A)

i_l = 0
for i_r in range(k, n):
  #print('i_l, i_r = ', i_l, i_r)
  if A[i_l] > A[i_r]:
    print('No')
  else:
    print('Yes')

  i_l = i_l + 1
# Judge status: Accepted
import math
a,b,c=map(int,input().split())
aa=math.sqrt(a)
bb=math.sqrt(b)
cc=math.sqrt(c)
ans=a**2+b**2+c**2-2*(a*b+b*c+a*c)
ans2=((aa+bb+cc)*(c-a-b+2*math.sqrt(a*b)))
print("Yes" if 0<ans/ans2 else "No")
# Judge status: Wrong Answer
n=int(input())
s=input()
ans=[]
for i in range(len(s)):
    ans.append(s[:i].count("I")-s[:i].count("D"))
print(max(ans))
# Judge status: Accepted
S="ACABABAABABA"
a,b = map(int,input().split())
print("Yes" if S[a-1]==S[b-1] else "No")
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)

Alice = 0
Bob = 0

for i in range(N):
  if i % 2 == 0:
    Alice += a.pop(0)
  else:
    Bob += a.pop(0)

print(Alice - Bob)
# Judge status: Wrong Answer
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
X = min(A, B, C, D, E)
print((N+1)//X + 4)
# Judge status: Wrong Answer
a,b=map(int,input().split())
print([a*b,-1][a|b>9])
# Judge status: Wrong Answer
W,H,x,y=map(int,input().split())
s=W*H/2
x=1 if W//2==x and H//2==y else 0
print('{} {}'.format(s,x))
# Judge status: Wrong Answer
k = int(input())
a = 0
for i in range(k):
  a = (a*10+7)/k
  if a == 0:
    print(i+1)
    quit()
print(-1)
# Judge status: Accepted
import math

a, b, water = map(int, input().split())
pool = a ** 2 * b

if water == pool:
    ans = 0
elif water > pool / 2:
    high = 2 * (pool - water) / (a ** 2)
    ans = 90 - math.degrees(math.atan(a / high))
elif water == pool / 2:
    ans = 45
else:
    high = 2 * water / (a * b)
    ans = 90 - math.degrees(math.atan(high / b))

print(ans)
# Judge status: Wrong Answer
a,b = input().split()
a1 = int(a)
bs = list(b)
b1 = int(bs[0])
b2 = 0
if len(b)==3:
  b2 = int(bs[2])*10
else:
  b2 = int(bs[2]+bs[3])
b1 = b1*100+b2
ans = int(a1*b1/100)
print(ans)
# Judge status: Wrong Answer
a = int(input("上底は？"))
b = int(input("下底は？"))
h = int(input("高さは？"))
daikei = (a + b) * h / 2
print("台形の面積は", daikei, "cm2")
# Judge status: Wrong Answer
a, b = map(int, input().split())

if a >= 13:
    print(b)
elif a > 5 and a < 13:
    print(b/2)
else:
    print(0)
# Judge status: Accepted
n, k = map(int, input().split())
s = list(map(int, input().split()))  # r, s, p
t = list(map(str, input()))

ans = 0
for i in range(n):
    if i-k >= 0:
        if t[i] == t[i-k]:
            t[i] = 'change'
        else:
            continue

for j in range(n):
    if t[j] == 'r':
        ans += s[2]
    elif t[j] == 's':
        ans += s[0]
    elif t[j] == 'p':
        ans += s[1]
    else:
        continue
print(ans)
# Judge status: Accepted
N = int(input())
a = [int(input()) for _ in range(N)]

a.sort()
sum_a = sum(a)
d = sum_a

for i in range(N):
    if a[i]%10 != 0:
        d = a[i]
        break

if sum_a%10 != 0:
    ans = sum_a
else:
    ans = sum_a-d

print(ans)
# Judge status: Wrong Answer
w,h,x,y=map(int,input().split())

if x==w or x==0:
    if y==h or y==0:
        print(0.0,0)
else:
    w2=w//2
    h2=h//2

    s1=h*w2
    s2=w*h2
    if s1>s2:
        print(s1,0)
    elif s1==s2:
        print(s1,1)
    else:
        print(s2,0)
# Judge status: Accepted
N = int(input())

SP =[]
for i in range(N):
  S, P  = input().split()
  app = [i+1,S,int(P)]
  SP.append(app)



SP.sort(key=lambda x: x[2], reverse=True)
SP.sort(key=lambda x: x[1])

for i in range(N):
  print(SP[i][0])
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())

for i in range(k):
    if a >= b:
        b *= 2
    elif b >= c:
        c *= 2

if a < b and b < c:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A,B,N=map(int,input().split())

if N<B:
    print(A*N//B-A*(N//B))
else:
    print(A*(B-1)//B)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
sum = 0
ans = 0
for i in range(1, N):
   sum +=A[i-1]
   sum = sum % (10**9 + 7)
   ans = ans + (sum * A[i]) % (10**9 + 7)
   ans = ans % (10**9 + 7)
print(ans)
# Judge status: Wrong Answer
a = int(input(""))
list = []
while(a):
    if(a%(-2)==0):
        list.append(0)
        a//=-2
    elif(a%(-2)==-1):
        list.append(1)
        a -= 1
        a//=-2

list.reverse()
for i in list:print(i,end='')
print()
# Judge status: Wrong Answer
n,m=[int(x) for x in input().rstrip().split()]
mm=m//2
ave=(n+mm)//2
print(ave)
# Judge status: Accepted
N=int(input())
List=list(map(int,input().split()))

counter=0
mj=N
for i in range(N):
  if mj>List[i]:
    mj=List[i]
  if List[i]==mj:
    counter+=1
print(counter)
# Judge status: Accepted
N = int(input())
S = input()
r = 0
g = 0
b = 0
for s in S:
    if s == "R":
        r += 1
    if s == "G":
        g += 1
    if s == "B":
        b += 1
res = r * g * b
for i in range(N):
    for j in range(i + 1, N):
        if S[i] != S[j]:
            if j * 2 - i < N:
                if S[j * 2 - i] != S[i] and S[j * 2 - i] != S[j]:
                    res -= 1
print(res)
# Judge status: Accepted
a, b = map(int, input().split())
cnt = 0
for i in range(a, b+1):
    si = str(i)
    if si[0] == si[4] and si[1] == si[3]:
        cnt += 1
print(cnt)
# Judge status: Accepted
k, s = map(int, input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    z = (s - i - j)
    if 0<= z <= k:
      ans += 1
        
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
X = list(map(int, input().split()))

if N >= M:
    print(0)
    exit()

X = sorted(X)
# print(X)
d = [X[i + 1] - X[i] for i in range(len(X) - 1)]
d = sorted(d)
# print('d', d)
if N == 1:
    print(sum(d))
else:
    print(sum(d[:-N + 1]))
# Judge status: Accepted
try:
    N = int(input())
    A = int(input())

    if N%500!=0:
        mod = N%500
        print('Yes' if A>mod else 'No')
    else:
        print('Yes')
except EOFError:
    pass
# Judge status: Wrong Answer
a, b, c = map(int,input().split())

print("YES" if abs(b-a) == abs(c-b) else "NO")
# Judge status: Accepted
A = input()
B = input()
C = input()

check = A[0]
A = A[1:]
while True:
  if check == "a":
    if len(A) == 0:
      print("A")
      exit()
    check = A[0]
    A = A[1:]
  elif check == "b":
    if len(B) == 0:
      print("B")
      exit()
    check = B[0]
    B = B[1:]
  elif check == "c":
    if len(C) == 0:
      print("C")
      exit()
    check = C[0]
    C = C[1:]
# Judge status: Accepted
n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
    if x>=a[i]:
        ans+=1
        x-=a[i]
    else:
        break
if ans == n:
    if x!=0:
        ans-=1
print(ans)
# Judge status: Wrong Answer
n = int(input())

arr= ['a','b','c','d','e','f','g','h','i','j']

def f(x, s):
  if x == n:
    print(s)
    return
  for i in range(n):
    f(x+1, s+arr[i])
    if s+arr[i] == "".join(arr[:i+1]):
      break
f(0, "")
# Judge status: Accepted
n, m = map(int, input().split())
if n > 1 and m > 1:
    ans = n * m - 2 * (n + m) + 4
elif n > 1:
    ans = n - 2
elif m > 1:
    ans = m - 2
else:
    ans = 1
print(ans)
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    w=list(input())
    w.sort()
    if len(w)%2!=0:
        print('No')
    else:
        for i in range(0,len(w)-2,2):
            if w[i]!=w[i+1]:
                print('No')
                break
        print('Yes')
resolve()
# Judge status: Wrong Answer
x = int(input())

if x / 11 < 1:
    ans = 1
    if x / 5 >= 1:
        ans = 2
else:
    ans = x // 11 * 2 + 1

print(ans)
# Judge status: Accepted
n = int(input())
A, B = [0] * n, [0] * n
for i in range(n):
    A[i],B[i] = map(int, input().split())

A.sort()
B.sort()
ans = 0
if n % 2 == 1:
    ans = B[n // 2] - A[n // 2] + 1
else:
    large = B[n // 2] + B[n // 2 - 1]
    small = A[n // 2] + A[n // 2 - 1]
    ans = large - small + 1

print(ans)
# Judge status: Accepted
a, b, c, k = list(map(int, input().split()))
print(min(a, k) - max((k - (a + b), 0)))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    a = list(map(int, input().split()))
    l = [0]*(10**5 + 10)


    for i in set(a):
        for j in a:
            if j - 1 <= i <= j + 1:
                l[j] += 1
        
    print(max(l))

main()
# Judge status: Accepted
s = input()
cnt = 0
for i in range(3):
    if(s[i] == "1"):
        cnt += 1
print(cnt)
# Judge status: Accepted
def solve():
    o = input()
    e = input()

    try:
        for i in range(max(len(o), len(e))):
            print(o[i], end='')
            print(e[i], end='')
    except:
        pass


if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
n,k=map(int,input().split())
d_ls=[int(z) for z in input().split()]

b=[0]*n
for kk in range(k):
  for i,d in enumerate(d_ls):
    i_front=i+d+0.5
    i_back=i-d-0.5
    for ii,dd in enumerate(d_ls):
      if i_front>=ii>=i_back:
        b[ii]+=1
  for iii,bbb in enumerate(b):
    d_ls[iii]=bbb

bl=[str(a) for a in b]
bl=" ".join(bl)
print(bl)
# Judge status: Accepted
N,K = map(int,input().split())
List=[list(map(int,input().split())) for i in range(N)]

List.sort()
cnt = 0

for i in range(len(List)):
  cnt = cnt + List[i][1]
  if cnt >= K:
    ans = List[i][0]
    break
print(ans)
# Judge status: Wrong Answer
n = int(input())
ls = []

for i in range(n):
    a = int(input())
    ls.append(a)

ls.sort()

ans = 0
k = -1
count = 0
for i in range(n):
    if ls[i] != k:
        if count % 2 == 1:
            ans += 1
        count = 1
        k = ls[i]
    else:
        count += 1
print(ans)
# Judge status: Wrong Answer
s = str(input())

if s[2] == s[3]:
    if s[4] == s[5]:
        print("Yes")

else:
    print("No")
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import *

S = input()[:-1]
cnt = defaultdict(int)
cnt[0] = 1
now = 0
ans = 0

for i in range(len(S)-1, -1, -1):
    now = (int(S[i])*pow(10, len(S)-1-i, 2019)+now)%2019
    ans += cnt[now]
    cnt[now] += 1

print(ans)
# Judge status: Accepted
T = list(input())
if len(T) == 1:
  if T[0] == "?":
    print("D")
  else:
    print("".join(T))
else:
  for i in range(len(T)):
    if i > 0 and T[i] == "?" and T[i-1] == "P":
      T[i] = "D"
    elif i < len(T) -1 and T[i] == "?" and (T[i+1] == "D" or T[i+1] == "?"):
      T[i] = "P"
    elif T[i] == "?":
      T[i] = "D"
  print("".join(T))
# Judge status: Accepted
S=input()
diff=[0]*(len(S)-2)
for i in range(len(S)-2):
    diff[i]=abs(753-int(S[i:i+3]))
print(min(diff))
# Judge status: Wrong Answer
n,m = list(map(int, input().split()))
hoge = list(map(int, input().split()))

wa = sum(hoge)
if wa >= n:
  print(-1)
else:
  print(n - wa)
# Judge status: Accepted
S = 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)-1, -1, -1):
    if S[i] == '>':
        ans[i] = max(ans[i + 1] + 1, ans[i])
print(sum(ans))
# Judge status: Accepted
N = int(input())

ans = 10 ** N - (9 ** N + 9 ** N - 8 ** N)
ans = ans % (10 ** 9 + 7)

print(ans)
# Judge status: Accepted
A, B = map(int, input().split())

if (B - 1) % (A - 1) == 0:
    ans = (B - 1) // (A - 1)
else:
    ans = (B - 1) // (A - 1) + 1

print(ans)
# Judge status: Accepted
n,m = map(int, input().split())

if n > (m+n)/3:
    print(m//2)
    exit()

ans = n
m -= 2*n
ans += m//4
print(ans)
# Judge status: Wrong Answer
try:
    D = int(input())
    T = int(input())
    S = int(input())
except:
    print('Error')
else:
    tmp = T * S
    if D > tmp:
        print('No')
    else:
        print('Yes')
# Judge status: Wrong Answer
import sys
import itertools

# import numpy as np

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

N, *H = map(int, read().split())
cnt = 1

H.sort()

ans = H[0]
print(H)
for i in H[1:]:
    print(ans, cnt)

    ans += cnt * i
    cnt *= 2
    print(ans, cnt)
print(ans / cnt)
# Judge status: Wrong Answer
import math


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


d = 30*(h+m/60)-6*m
e = 360-d
f = int(min(d,e))
y = math.cos(math.radians(f))


x = a**2+b**2-2*a*b*y
print(math.sqrt(x))
# Judge status: Accepted
s = input()
a = s[:int((len(s) - 1) / 2)]
b = s[int(((len(s) + 3) / 2) - 1):]
if a == a[::-1] and b == b[::-1] and s == s[::-1]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
S,W = map(int,input().split())

if(S>W):
    print("safe")

else:
    print("unsafe")
# Judge status: Wrong Answer
import math
R=float(input())
L=2*math.pi*R
# Judge status: Accepted
X = int(input())
a = 100
i = 0

while a < X:
  i += 1
  a += a // 100
  
print(i)
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
count = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1, n):
            if l[i] != l[j] and l[j] != l[k] and l[i] != l[k] and l[k] < l[i] + l[j]:
                count += 1

print(count)
# Judge status: Accepted
import math

H,A=map(int,input().split())
print(math.ceil(H/A))
# Judge status: Accepted
n=int(input())
a=[int(i) for i in input().split()]
max_height=0
ans=0
for i in a:
  if max_height>i:
    ans+=max_height-i
  else:
    max_height=i
    
print(ans)
# Judge status: Accepted
x=input()
print("A"+x[8]+"C")
# Judge status: Wrong Answer
n = int(input())

#約数
def make_divisors(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

list_n = make_divisors(n)

a = len(list_n)
ans = []
for i in range(0, a-1, 2):
    ans.append(list_n[i]+list_n[i+1])

ans.sort()

print(ans[0]-2)
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
y = x
y = sorted(y)
a = y[n // 2 -1]
b = y[n // 2]
for i in range(n):
  if x[i] <= a:
    print(b)
  elif x[i] >= b:
    print(a)
# Judge status: Accepted
N,K,S=map(int,input().split())

if S==10**(9):
    ans=[S-1]*N
else:
    ans=[10**(9)]*N
for i in range(K):
    ans[i]=S
print(*ans)
# Judge status: Accepted
s=input()
t=input()
S=sorted(map(s.count,set(s)))
T=sorted(map(t.count,set(t)))
print("Yes"if S==T else "No")
# Judge status: Accepted
s = input()

def has_A(x):
    if x[0] == 'A': return True
    return False


def has_C(x):
    if x[2:-1].count('C') == 1: return True
    return False


def is_lower_this_case(x):
    i = x.index('C')
    if x[1:i].islower() and x[i+1:].islower():
        return True
    return False

if has_A(s) and has_C(s) and is_lower_this_case(s):
    print('AC')
else:
    print('WA')
# Judge status: Wrong Answer
N,M = [int(i) for i in input().split()]
S = 0

M -= 2*N

S = N + M // 4

print(S)
# Judge status: Wrong Answer
n,m=map(int,input().split())
X=[]
for i in range(n):
    a,b=map(int,input().split())
    X.append([a,b])
Y=sorted(X,key=lambda x:(x[1]), reverse=True)

ans=0
d=0
for i in range(n):
    if d+Y[i][0]<=m:
        ans+=Y[i][1]
        d+=1
print(ans)
# Judge status: Accepted
import numpy as np
import itertools

N, M, X = map(int, input().split())
CA = []
cost = 12 * (10**5) + 1

for _ in range(N):
  CA.append(list(map(int, input().split())))

for T in itertools.product([1,0], repeat = N):
  Flag = True
  ans = np.zeros(M+1)
  for i in range(N):
    if T[i] == 1:
      ans += np.array(CA[i])

  for j in range(1, M+1):
    if ans[j] < X:
      Flag = False
      break
  
  if Flag:
    cost = min(cost, ans[0])

if cost == 12 * (10**5) + 1:
  print(-1)
else:
  print(int(cost))
# Judge status: Accepted
a,b,c=[int(i) for i in input().split()]

if b-a==c-b:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
s = str(input())

l = len(s)

if s[0]=='9' or s[-1]=='9':
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
S = input().strip()
print("Yes" if len(S) == len(set(list(S))) else "No")
# Judge status: Accepted
num = int(input())
a_list = list(map(int, input().split(" ")))
ans_list = [0] * num

for i in range(num):
    ans_list[a_list[i]-1] = i+1

for i in range(num-1):
    print(ans_list[i], end=" ")
print(ans_list[num-1])
# Judge status: Accepted
def main():
    n,k = map(int,input().split(" "))
    l =[True]*n
    for i in range(k):
        d = int(input())
        As = list(map(int,input().split(" ")))
        for A in As:
            l[A-1] = False
    
    print(l.count(True))
main()
# Judge status: Accepted
from math import ceil

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

print(ceil((N - 1) / (K - 1)))
# Judge status: Wrong Answer
a,b,c = map(float,input().split())

if  4*a*b < (c-a-b)**2:
     print('Yes')
else:
     print('No')
# Judge status: Accepted
N, M = map(int, input().split())
List = list(map(int, input().split()))

if sum(List) <= N:
  print(N-sum(List))
else:
  print(-1)
# Judge status: Accepted
X=int(input())
Y=X%100
Z=X//100
if Y>(Z*5):
	print(0)
else:
	print(1)
# Judge status: Wrong Answer
string = input()
if string.isupper() == True:
    print("A")
else:
    print("a")
# Judge status: Wrong Answer
import math
n=int(input())
p=[]
for i in range(n):
    p.append(list(map(int,input().split())))
#print(p)
ans=0
for i in range(n):
    for j in range(n):
        if i!=j:
            print(i,j)
            ans+=math.sqrt((p[j][0]-p[i][0])**2+(p[j][1]-p[i][1])**2)
ans/=n
print(ans)
# Judge status: Wrong Answer
N, x = [int(z) for z in input().split()]
children = [int(z) for z in input().split()]

children.sort()
cnt = 0

for i in children:
    if x - i < 0:
        break
    else:
        x -= i
        cnt += 1
        
print(cnt)
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))

A = sorted(A, reverse=True)

X = A[M-1]
Y = sum(A)
th = Y / (4*M)

if X >= th:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
# coding utf-8
import math
H = int(input())

max_h = 10**12
n = 1

while H > 1:
    H //=  2
    n += 1
    print(H)

print((2**n)-1)
# Judge status: Accepted
S = input()

s = set(S)

if len(s) == 26:
    print('None')
else:
    for i in 'abcdefghijklmnopqrstuvwxyz':
        if i not in S:
            print(i)
            break
# Judge status: Accepted
N = int(input())
X = list(map(int,input().split()))
X.sort()
m=10**18
for p in range(102):
    s=0
    for i in range(N):
       s+= (X[i]-p)**2
    if(m>s): m=s
print(m)
# Judge status: Accepted
def main():
    N = int(input())
    s = "".join(sorted(input()))
    dic = {s:1}
    ans = 0
    for _ in range(N-1):
        s = "".join(sorted(input()))
        if s in dic:
            dic[s] += 1
        else:
            dic[s] = 1
    for i in dic.values():
        ans += (i*(i-1))//2
    return ans

if __name__ == '__main__':
    print(main())
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
cash = 1000
kabu = 0
for i,j in zip(a[:-1], a[1:]):
  if i < j:
    kabu = cash // i
    cash = cash - i * kabu
  else:
    cash += kabu * i
    kabu = 0
  
print(cash + kabu * a[-1])
# Judge status: Accepted
n, w = map(int, input().split())
things = []
things.append([0,0])
things += [list(map(int, input().split())) for _ in range(n)]

dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]

def do_dp():
  for i,thing in enumerate(things):
    dp_1 = dp[i-1]
    for j in range(1, w + 1):      
      dp[i][j] = dp_1[j-thing[0]] + thing[1]  if (j - thing[0]) >= 0 else dp_1[j]
      dp[i][j] = max(dp[i][j], dp_1[j])

do_dp()
print(dp[n][w])
# Judge status: Accepted
import math
from functools import reduce

n = int(input())
t = list(int(input()) for _ in range(n))

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


print(lcm_list(t))
# Judge status: Accepted
from sys import stdin
input = stdin.readline

x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
a = p[:x] + q[:y] + r
a.sort(reverse=True)
print(sum(a[:x+y]))
# Judge status: Accepted
N,M = map(int,input().split())
H = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(M)]
load = [[] for _ in range(N)]
ans = 0

for a,b in AB:
  a-=1
  b-=1
  load[a].append(b)
  load[b].append(a)
  
for i,lis in enumerate(load):
  if len(lis)==0:
    ans+=1
  else:
    judge = True
    for j in lis:
      if H[i]<=H[j]:
        judge = False
        break
    if judge:
      ans+=1
      
print(ans)
# Judge status: Accepted
def main():
    N=int(input())
    A=[int(_) for _ in input().split()]
    if 0 in A:
        print(0)
        exit()
    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18:
            print(-1)
            exit()
    print(ans)

main()
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
count = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
        if ((l[i]) + (l[j])) > (l[k]) and ((l[k]) + (l[j])) > (l[i]) and ((l[i]) + (l[k])) > (l[j]):
          count += 1
print(count)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
dp=[0]*(10**5+1)
for i in range(1,10**5+1):
  dp[i]=a.count(i)
# Judge status: Accepted
num = list(map(int, input().split(" ")))
x = 1
for i in num:
  if i == 0:
    print(x)
  else:
    x += 1