peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
S = list(input())
c = [0, 0]
n = 0
s = ""
for i in range(len(S)):
  if s == "":
    s = S[i]
    n = 1
  elif s == S[i]:
    n += 1
  else:
    if n > 1:
      if S[i] == "<": c[0] += n
      else: c[1] += n
    n = 1
    s = S[i]

if n > 1:
  if S[i] == "<": c[0] += n
  else: c[1] += n
c = max(c)
ans = c * (c+1) // 2

import math
if c == 0:
  ans = math.ceil(len(S)/2) 
  
print(ans)
# Judge status: Accepted
import math 
x = int(input())
Su = math.floor(x/11)
M = x%11
if M ==0:
    print(Su*2)
else:
    if M <= 6:
        print(Su*2+1)
    else:
        print(Su*2+2)
# Judge status: Accepted
N = int(input())
S = input()
for s in S :
    i = ord(s) + N
    if i > 90 :
        i -= 26
    print(chr(i), end="")
print()
# Judge status: Wrong Answer
N, K=map(int, input().split())
i=1
while K**i<N:
  i+=1
print(i)
# Judge status: Accepted
K, X = map(int, input().split())
print(*list(range(X - K  + 1, X + K)))
# Judge status: Accepted
N = int(input())
A = [int(input()) for n in range(N)]
B = 0

for n in range(N):
  B = A[B]-1
  if B==1:
    print(n+1)
    exit()

print(-1)
# Judge status: Wrong Answer
n,k,s=map(int,input().split())
li=[]
for i in range(k):
    li.append(s)
for i in range(n-k):
    li.append(s+1)
print(*li)
# Judge status: Accepted
import math
n= int(input())
a_list = list(map(int, input().split()))
gcd = a_list[0]
for i in range(1,n):
    gcd = math.gcd(gcd,a_list[i])
    
    
print(gcd)
# Judge status: Accepted
def I(): return int(input())
def MI(): return map(int, input().split())
def LMI(): return list(map(int, input().split()))
MOD = 10 ** 9 + 7


S = input()
S = ''.join(list(reversed(S)))
while len(S) > 0:
    if S[:7] == 'remaerd':
        S = S[7:]
    elif S[:6] == 'resare':
        S = S[6:]
    elif S[:5] in ['esare', 'maerd']:
        S = S[5:]
    else:
        print('NO')
        exit(0)
print('YES')
# Judge status: Accepted
import math

def colcu (bli,ali,D):
    num = 0
    for i in range(D):
        num += (bli[i] - ali[i]) ** 2
    return math.sqrt(num)

N,D = map(int, input().split())
pli = []
for i in range(N):
  pli.append(list(map(int, input().split())))

an = 0
for i in range(N-1):
 for t in range(i+1,N):
     if colcu(pli[i],pli[t],D).is_integer():
         an += 1
print(an)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

dic1 = dict()

n = int(readline())
for i in range(n):
    a = int(readline())
    if a in dic1:
        dic1[a] += 1
    else:
        dic1[a] = 1

ans = 0
for i in dic1.values():
    if not even(i):
        ans += 1
print(ans)
# Judge status: Wrong Answer
s = input()

condition = s[2]==s[3] and s[3]==s[4]

if condition:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N = list(input())
ans = 0

for i in range(len(N)):
  if N[len(N)-1-i] == "Z":
    ans = len(N) - i
    break
  else:
    pass
  
  for j in range(len(N)):
    if N[j] == "A":
      ans -= (j - 1)
      break
    else:
      pass
    
print(ans)
# Judge status: Accepted
n = int(input())

d = dict()

for _ in range(n):
    d[input()] = 1

print(len(d))
# Judge status: Accepted
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    l=list(map(int,input().split()))
    l.sort()
    YESNO(l[0]==l[1]==5 and l[2]==7)

if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,C = map(int, input().split())

list = sorted([A,B,C])

print('YES' if list == [5,5,7] else 'NO')
# Judge status: Wrong Answer
from collections import Counter
n, k = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=False)
ans = 0
while len(Counter(a)) > k:
  x = a.count(a[0])
  a = a[x:]
  ans += x
print(ans)
# Judge status: Wrong Answer
x, y = map(int,input().split())
ans = set()
if y >= x:
    ans.add(y-x)
if x*y < 0:
    ans.add(abs(abs(x)-abs(y)+1))
else:
    
    ans.add(abs(abs(x)-abs(y))+2)

print(min(ans))
# Judge status: Accepted
ST=list(map(str, input().split()))
A,B=map(int, input().split())
U=input().split()

if ST[0]==U[0]:
  print(A-1,B)
else:
  print(A,B-1)
# Judge status: Accepted
import math

a, b, h, m = map(int, input().split())
h_rad = (h * 60 + m) * math.pi / 360
m_rad = m * math.pi / 30
cosine = math.cos(abs(h_rad - m_rad))

print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * cosine))
# Judge status: Accepted
import sys
A,B = map(int,input().split())

if not ( 1 <= A <= 20 ): sys.exit()
if not ( 1 <= B <= 20 ): sys.exit()
if not (isinstance(A,int) and isinstance(B,int)): sys.exit()

print(A*B) if A <= 9 and B <= 9 else print(-1)
# Judge status: Accepted
a, b, x = map(int, input().split())
min_div = a // x
max_div = b // x

if a % x == 0:
    ans = max_div - min_div + 1
else:
    ans = max_div - min_div
    
print(ans)
# Judge status: Wrong Answer
#--------------------------------------------
#ライブラリ呼び出し
import sys
import math
#--------------------------------------------
D, N = map(int, input().split())

if N ==100:
    N=101
a=100**D
print(a*N)
# Judge status: Accepted
s=input()
r_s=s[::-1]
c_a=s.find("A")
c_rz=r_s.find("Z")
c_z=len(s)-1-c_rz

print(c_z-c_a+1)
# Judge status: Accepted
import collections
n = int(input())
a = list(map(int, input().split()))
cnt = collections.Counter(a)
total = 0
for key in cnt.keys():
    total += cnt[key]*(cnt[key]-1) // 2
for i in a:
    ans = total
    ans -= cnt[i] * (cnt[i]-1) / 2
    ans += (cnt[i]-1) * (cnt[i]-2) / 2
    print(int(ans))
# Judge status: Wrong Answer
n=int(input())
a=[int(input())for _ in range(n)]
b=sorted(a)

for a in b:
  if a==b[-1]:
    print(b[-2])
  else:
    print(b[-1])
# Judge status: Wrong Answer
s = input()
if s[1] == "B":
    print("R")
else:
    print("B")
# Judge status: Accepted
import numpy as np
n = int(input())
a = list(map(int, input().split()))
a = np.array(a)
mod = 10**9 + 7
ans = 0
for i in range(60):
  # a要素のi番目のデータが1であるデータの数 iビット右シフト &:論理積 
  b = np.count_nonzero(a >> i & 1)
  #print(a>>i&1)
  # 2進数から10進数 b*(N-b)は(1の個数)*(0の個数)
  ans += 2 ** i * b*(n-b)
  ans %= mod
print(ans)
# Judge status: Accepted
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    print((a[0]+a[1] )%24)
# Judge status: Wrong Answer
N = int(input())
S = input()
alpha = [0]*123

for n in S:
    num = ord(n)
    alpha[num] += 1
    
ans = 1
for i in range(97,122):
    ans *= alpha[i]+1

print(ans-1)
# Judge status: Accepted
n = int(input())

i = 1
l = [1]
while n >= (i+1)*i//2:
    i += 1
    l.append(i)

l.remove((i+1)*i//2-n)

for j in l:
    print(j)
# Judge status: Accepted
def main():
    N = int(input())
    a = sorted(map(int, input().split()))[::-1]
    diff = sum(a[::2]) - sum(a[1::2])
    print(diff)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
import math

for i in range(50000):
  if math.floor(i*1.08) == n:
    print(i)
    exit()
    
print(":(")
# Judge status: Accepted
N, W = map(int, input().split())
wv = []

for i in range(N):
    w, v = map(int, input().split())
    wv.append([w, v])

dp = [[0]*(W+1) for _ in range(N+1)]

for i in range(N):
    for j in range(W+1):
        if j - wv[i][0] >= 0:
            dp[i+1][j] = max(dp[i][j], dp[i][j-wv[i][0]]+wv[i][1])
        else:
            dp[i+1][j] = dp[i][j]
print(dp[N][W])
# Judge status: Accepted
n = int(input())
s = input()
ans, val = 0, 0
for i in s:
    if i == 'I':
        val += 1
    else:
        val -= 1
    ans = max(ans, val)
print(ans)
# Judge status: Accepted
from math import ceil
n=int(input())
c=[0]*n
s=[0]*n
f=[0]*n
for i in range(n-1):
  c[i],s[i],f[i]=map(int,input().split())
for i in range(n):
  t=s[i]+c[i]
  if i<n-1:
    for j in range(i+1,n-1):
      if s[j]>=t:
        t=s[j]+c[j]
      else:
        t=ceil(t/f[j])*f[j]+c[j]
  print(t)
# Judge status: Accepted
N = int(input())
answer = ''
while N != 0:
    if N % 2 != 0:
        N -= 1
        answer = '1' + answer
    else:
        answer = '0' + answer
    N //= -2

if answer == '':
    answer = '0'

print(answer)
# Judge status: Accepted
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)

    return divisors


n, m = map(int, input().split())

ans = 0
for i in make_divisors(m):
    if i <= m / n:
        ans = max(ans, i)

print(ans)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
a.sort()
A = max(a)
b = [0]*A
for i in range(N):
  if b[a[i]-1] == 0:
    for j in range(a[i], A+1, a[i]):
      b[j-1] += 1
  elif b[a[i]-1] == 1:
      b[a[i]-1] += 1
n = 0      
for i in range(N):
  if b[a[i]-1] == 1:
    n += 1
print(n)
# Judge status: Wrong Answer
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n,d = i2()
x = []
for i in range(n):
	a = intl()
	x.append(a)

test = 0
cnt = 0
for i in range(n):
	for j in range(d):
		test += (x[i][j] - x[i-1][j])**2
	if ( (test)**(1/2) )%1 == 0:
		cnt += 1
	test = 0
print(cnt)
# Judge status: Accepted
X, Y, Z = map(int, input().split())
b = Y + 2 * Z
ans = 1
while True:
  b += Y + Z
  if b > X:
    break
  else:
    ans += 1
print(ans)
# Judge status: Accepted
S = input()
odd = S[1::2]
even = S[::2]
print(min(odd.count("1") + even.count("0"), even.count("1") + odd.count("0")))
# Judge status: Wrong Answer
n, x = list(map(int, input().split()))
Ls = list(map(int, input().split()))

m = Ls[0]
count = 0
for i in range(1,n):
    if m <= x:
        count += 1
        m += Ls[i]
    else:
        break
print(count+1)
# Judge status: Accepted
N , K = map(int, input().split())
Dk = input().split()

for i in range(N,10*N+1):
    if set(str(i))&set(Dk) == set():
        print(i)
        break
# Judge status: Accepted
x,y = map(int,input().split())
if x%y!=0:
    print(x)
else:
    print(-1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

ans = gcd(a[0], a[1])
for i in range(2, n):
    ans = gcd(ans, a[i])
print(ans)
# Judge status: Accepted
s=input()
a=s.count('0')
b=s.count('1')
c=min(a,b)
print(2*c)
# Judge status: Accepted
a,b,c,x,y=map(int,input().split())
p=10**9
for i in range(max(x,y)+1):
  p=min(p,a*max(0,x-i)+b*max(0,y-i)+c*2*i)
print(p)
# Judge status: Accepted
x, y, z = map(int,input().split())

result = 0
while y*result + z*(result+1) <= x:
  result += 1

print(result-1)
# Judge status: Wrong Answer
N = int(input())
lcnt = 0
rcnt = 0
res = ""
for char in input():
  if char == ")":
    rcnt += 1
  else:
    lcnt+=1
    for i in range(rcnt):
      res += "("
    for i in range(rcnt):
      res += ")"
      rcnt = 0
else:
  for i in range(lcnt - rcnt) :
    res = "(" + res
  for i in range(rcnt) :
    res += "("
  for i in range(max(lcnt,rcnt) ):
    res += ")"
  print(res)
# Judge status: Wrong Answer
s = str(input())
for i in range(4):
    if s[i - 1] == s[i]:
        print('Bad')
        exit()
print('Good')
# Judge status: Accepted
import math
import sys
N = int(input())
N_next = math.ceil((math.sqrt(N)+1)**2)
#print(N_next)

    
    
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
    
#print(primes(7)[-1])
for i in range(N,N_next):
    if primes(i)[-1] >= N:
        print(i)
        sys.exit()
# Judge status: Accepted
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
if (X < Y)&(max(x) < min(y))&(max(x) < Y)&(X < min(y)):
    print("No War")
else:
    print("War")
# Judge status: Wrong Answer
import collections

n = int(input())
List = list(map(int, input().split()))
Col = collections.Counter(List)
CountList = list(Col) 
for i in range(n-len(CountList)):
    CountList.append(0)

for i in CountList:
    print(i)
# Judge status: Accepted
N = int(input())
alp_list = ['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']
ans = []
 
for i in range(1,12):
  if N <= 26 ** i:
    N -= 1
    for j in range(i):
      ans += alp_list[N % 26]
      N  = N // 26
    break
  else:
    N -= 26 ** i
ans.reverse()
print("".join(ans))
# Judge status: Accepted
x=int(input())
ans=(x//500)*1000
x%=500
ans+=(x//5)*5
print(ans)
# Judge status: Accepted
def inpl(): return list(map(int, input().split()))
A, B, M = inpl()
A = inpl()
B = inpl()
res = min(A) + min(B)
for _ in range(M):
    x, y, c = inpl()
    tmp = A[x-1] + B[y-1] - c
    if tmp < res:
        res = tmp
print(res)
# Judge status: Wrong Answer
S = "ABC"

if S == "ABC":
  
  print("ARC")
  
else:
  
  print("ABC")
# Judge status: Wrong Answer
X, Y = map(int, input().split())

y = Y//2 - X
x = 2*X - Y//2
if x>=0 and y>=0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b, c= map(int, input().split())
if a + b + c >= 22:
  print('bust')
else:
  print('win')
# Judge status: Accepted
A, B, C, D = map(int, input().split())
l = [i for i in range(A, B)] + [i for i in range(C, D)]
result = [i for i in set(l) if l.count(i) > 1]
print(len(result))
# Judge status: Accepted
def main():
    X = int(input())
    if X >= 30:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S=input("   ")
if S==("AAA"):
     print("NO")
else:
   print("Yes")
# Judge status: Accepted
def solve():
    N, M = input().split()
    if N == M:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
count = 0
num = int(input())
p = list(map(int, input().split()))

for i in range(len(p)-2):
    q = sorted(p[i:i+3])
    print(q)
    if q[1] == p[i+1]:
        count += 1
        
print(count)
# Judge status: Accepted
s = input()

for idx in range(len(s)):
    if s[idx] == '?':
        print('D', end='')
    else:
        print(s[idx], end='')

print()
# Judge status: Wrong Answer
a, b, x = map(int, input().split())
a_mod = b//x+1
b_mod = (a-1)//x+1 if a > 0 else 0
ans = b_mod - a_mod
print(ans)
# Judge status: Accepted
n, k, *a = map(int, open(0).read().split())


def c(x):
    res = 0
    for b in a:
        # bを最大がxになるように、できるだけ少ない回数で
        # だいたいb/x等分？
        res += 0 - - b // x - 1
    return res <= k


ng = 0
ok = 10 ** 10
while ok - ng > 1:
    mid = (ok + ng) >> 1
    if c(mid):
        ok = mid
    else:
        ng = mid
print(ok)
# Judge status: Wrong Answer
A, B, C, K = map(int,input().split())

if K <= A:
	print(A)
	#　すべてAが取れる場合
else:
	if K <= A+B:
		print(A)
		# AとBの合計よりも取る枚数が少ない場合は-1のCを取らないのでAの総数と同じ値になる
	else:
		x = K - A -B
		#　合計値KからAとBの値を取り除いた値
		# この数値*-1をAをすべて取った値に足す
		print(A-x)
# Judge status: Accepted
N = int(input())
[t, x, y] = [[0],[0],[0]]
for i in range(N):
  input_line = list(map(int, input().split()))
  t.append(input_line[0])
  x.append(input_line[1])
  y.append(input_line[2])

can = True
for i in range(0, N):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if dt < dist:
    can = False
  if dt%2 != dist%2:
    can = False
  
if can == True:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N, x = map(int, input().split())
a = list(map(int, input().split()))

count = 0

for v in a:
    if v <= x and x >= 0:
        count +=1
        x -= v
        
if x != 0:
    count = count - 1

print(count)
# Judge status: Wrong Answer
n,x=map(int,input().split())
L=list(map(int,input().split()))
cnt=0
ans=0
for l in L:
    if cnt>=x:
        break
    cnt+=l
    ans+=1
print(ans)
# Judge status: Accepted
n = int(input())
alist = []
for i in range(n):
    a = int(input())
    alist.append(a)
aalist = sorted(alist)
ans = 0
for i in range(n):
    ans = aalist[-1]
    if alist[i] == aalist[-1]:
        ans = aalist[-2]
    print(ans)
# Judge status: Wrong Answer
k=list(map(int,input().split()))
k.sort
print(k[0]+k[1])
# Judge status: Accepted
n=0
for s in input().strip():
  if s=="1":
    n+=1
print(n)
# Judge status: Accepted
from collections import deque

n, m = [int(w) for w in input().split()]
links = [[] for i in range(n + 1)]
mark = [-1] * (n + 1)

for i in range(m):
    a, b = [int(w) for w in input().split()]
    links[a].append(b)
    links[b].append(a)

q = deque([1])
while q:
    now = q.popleft()
    for l in links[now]:
        if mark[l] == -1:
            q.append(l)
            mark[l] = now

if -1 in mark[2:]:
    print("No")
else:
    print("Yes")
    print("\n".join([str(w) for w in mark[2:]]))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
S = input()
if S[-1:] == 's':
    print(S+'es')
else:
    print(S+'s')
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(0, n-1):
    for j in range(i+1, n):
        ans+= l[i]^l[j]
print(ans)
# Judge status: Accepted
n = int(input())
print(n ** 2)
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))[::-1]
INF = float('inf')
last = INF
for i in h:
    if last >= i:
        last = i
    elif i - last == 1:
        last -= 1
    else:
        print("No")
        exit(0)
print("Yes")
# Judge status: Accepted
tako = list(map(int, input().split()))
if tako[0] % tako[1] != 0:
  print(tako[0]//tako[1]*tako[2]+tako[2])
else:
  print(tako[0]//tako[1]*tako[2])
# Judge status: Accepted
from bisect import bisect_left

n = int(input())
A=  list(map(int,input().split()))
A.sort()
am = A[-1]
amin = 0
ans = 0
for a in A[:-1]:
  if min(a, am-a) > amin:
    amin = min(a,am-a)
    ans = a
    
print(am , ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

n, m = map(int, input().split(' '))

WAs = [0] * n
correct = 0
penalty = 0
for i in range(m):
    p, s = input().strip().split(' ')
    p = int(p) - 1
    if WAs[p] == -1:
        continue
    if s == 'AC':
        penalty += WAs[p]
        correct += 1
        WAs[p] = -1
    else:
        WAs[p] += 1

print(correct, penalty)
# Judge status: Wrong Answer
N=int(input())
power=1
for i in range(1,N+1):
  power=power*i
  power=power%(10*9+7)
print(power)
# Judge status: Accepted
n = int(input())
as_ = list(map(int, input().split()))
as_ = sorted(as_)

num = 0

a_max = max(as_)
a_valid_map = [True] * (a_max + 1)
for i in range(len(as_) - 1):
    a = as_[i]
    if a_valid_map[a]:
        for j in range(a_max // a + 1):
            a_valid_map[a * j] = False
        if a != as_[i + 1]:
            num += 1
if a_valid_map[a_max]:
    num += 1

print(num)
# Judge status: Accepted
s = list(input())
t = list(input())
ans = float("INF")
for i in range(len(s)-len(t)+1):
    count = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            continue
        count += 1
    ans = min(ans,count)
print(ans)
# Judge status: Accepted
price = [int(w) for w in input().split()]
n = int(input())
price[0]*=4
price[1]*=2
cheap = min(price[:3])

ans = n // 2 * min(cheap * 2, price[3])
ans += n % 2 * cheap


print(ans)
# Judge status: Accepted
N,M=map(int,input().split())
P=[]
for i in range(M):
  P.append(list(map(int,input().split())))
  P[i].append(i)
S_P = sorted(
  P,
  key = lambda x: (x[0], x[1])
)
T=0
BT=S_P[0][0]
ANS=[]
for p in S_P:
  if BT != p[0]:
    BT=p[0]
    T=1
  else:
    T+=1
  ANS.append([p[2], '{:0=6}{:0=6}'.format(BT,T)])
  
A = sorted(
  ANS,
  key = lambda x: x[0]
)
for ans in A:
  print(ans[1])
# Judge status: Accepted
import fractions

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

A,B = map(int, input().split())
print(lcm(A,B))
# Judge status: Accepted
n=input()
print('Yes' if '9' in n else 'No')
# Judge status: Accepted
n,k=map(int,input().split())

if n%k==0:
  print(0)
else:
  print(1)
# Judge status: Accepted
n=int(input())
ans=0
for i in range(1,n+1):
  ans+=(i+i*(n//i))*(n//i)//2
print(ans)
# Judge status: Accepted
N,T = map(int, input().split())

ans = float("inf")
for _ in range(N):
    c,t = map(int, input().split())
    if t <= T:
        ans = min(ans , c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

res = float('inf')
for i in range(-100, 101):
    s = 0
    for v in a:
        s += (v - i) ** 2
    res = min(res, s)

print(res)
# Judge status: Wrong Answer
N = int(input())
while N >= 1000:
  N = N % 1000
print(1000 - N)
# Judge status: Accepted
mat = [list(map(int, input().split())) for _ in range(3)]
checks = [[0,1],[0,2],[1,2]]

for i,j in checks:
    if mat[i][i]+mat[j][j] != mat[i][j] + mat[j][i]:
        print('No')
        exit()

print('Yes')
# Judge status: Wrong Answer
N, X, Y = map(int, input().split())
A = [0]*N
for i in range(1, N):
    for j in range(i+1, N+1):
        if i<=X and j>=Y:
            A[j-i-Y+X+1] += 1
        else:
            A[j-i] += 1
for i in range(1, N):
    print(A[i])
# Judge status: Accepted
import sys
input = sys.stdin.readline

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

diff = b - a
sum = diff
for i in range(diff):
  sum += i

print(int(sum - b))
# Judge status: Accepted
N = int(input())
a = map(int, input().split())

num = 1
ans = 0

for i in a:
    if i == num:
        num += 1
    else:
        ans += 1

print(-1 if ans == N else ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3
a =list(map(int,input().split()))
a.sort()
x = a[-1]-a[1]
y = a[1] -a[0]
def dist(n):
    if n % 2 == 0: return n//2
    else: return n//2+2
print(min(2*x+y,dist(y)+x,dist(x+y)+dist(x)))
# Judge status: Wrong Answer
import numpy as np
import fractions

n = int(input())
a = np.array(input().split(),dtype = int)

G = 1

for i in a:
    G = G*i//fractions.gcd(G, i)

ans = 0

for i in a:
    ans += G//i
ans %= 10**9+7

print(ans)
# Judge status: Wrong Answer
from collections import Counter

MOD = 998244353

N = int(input())
D = [int(i) for i in input().split()]

counter = Counter(D)
# print("counter: {}".format(counter))

ans = 1
count = 1
for i, item in enumerate(sorted(counter.items(), key=lambda x: x[0])):
    # print("ans: {}".format(ans))
    # print("i: {}, item: {}".format(i, item))
    if i != item[0]:
        ans = 0
        break
    if item[0] == 0 and item[1] != 1:
        ans = 0
        break

    ans *= (count ** item[1]) % MOD
    count = item[1]
print(ans % MOD)
# Judge status: Accepted
n = int(input())
l=[]
for i in range(n):
    x, y = [int(i) for i in input().split()]
    l.append([x, y])
#print(l)

def kyori(a, b):
    return ((a[0]-b[0])**2 + (a[1]-b[1])**2)**0.5

soukyori = 0
for j in range(n):
    for k in range(n):
        soukyori = soukyori + kyori(l[j],l[k])
#print(soukyori)
print((soukyori * 2)/n/2)
# Judge status: Accepted
n,m,x,y = map(int,input().split())
a = list( map(int,input().split()) )
b = list( map(int,input().split()) )

ck = 0
ans = 0
for z in range(x+1,y+1):
  for i in a:
    if not i < z:
      break 
  else:
    for i in b:
      if not i >= z:
        break
    else:
      ck = 1
      ans = z
      break

print('No War' if ck else 'War')
# Judge status: Accepted
a, b = map(str, input().split())

f = int(a + b) ** 0.5

if (f.is_integer()) == 1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,q=map(int,input().split())
s=input()
list=[0]
for i in range(n-1):
  if s[i]=='A' and s[i+1]=='C':
    list.append(list[i]+1)
  else:
    list.append(list[i])
for j in range(q):
  l,r=map(int,input().split())
  print(list[r-1]-list[l-1])
# Judge status: Wrong Answer
a,b,k = map(int,input().split())
for i in range(1,min(a,b)):
  if(a%i==0)and(b%i==0):
    k -= 1
    if(k==0):
      print(i)
      break