peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from collections import defaultdict

def main():
    N, K = map(int, input().split())
    A = [a for a in input().split()]
    L = defaultdict(int)

    for i in range(N):
        L[A[i]] += 1

    L = sorted(list(L.items()), key= lambda x : x[1], reverse = True)
    
    cnt = 0
    typ = 0

    for i in range(len(L)):
        typ += 1
        if typ > K:
            pair = L[i]
            cnt += pair[1]
    
    print(cnt)
if __name__ == "__main__":
    main()
# Judge status: Accepted
from itertools import combinations
n,x,y = map(int,input().split())
cnt = [0]*n
for i,j in combinations(range(1,n+1),r=2):
    k = min(j-i,abs(x-i)+1+abs(y-j),abs(x-j)+1+abs(y-i))
    cnt[k]+=1
for i in range(1,n):
    print(cnt[i])
# Judge status: Wrong Answer
N = int(input())
sd = {}
cnt = 0
for i in range(N):
    str = ','.join(sorted(input()))
    if str in sd:
        sd[str] += sd[str]
    else:
        sd[str] = 1

print(sum(sd.values())-len(sd))
# Judge status: Accepted
n, m = map(int, input().split())
div = m//n
INF = 10**18
ans = -INF
for i in reversed(range(1, div+1)):
    if m % i != 0:
        continue
    if ans < i:
        ans = i
        break
print(ans)
# Judge status: Accepted
import numpy as np
def gcd(a, b):
	if a < b:
		a, b = b, a
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
a = np.array([int(x) for x in input().split()])
np.sort(a)
l = np.zeros(n + 1)
r = np.zeros(n + 1)
m = np.zeros(n)
for i in range(n):
	l[i + 1] = gcd(l[i], a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i + 1], a[i])
for i in range(n):
	m[i] = gcd(l[i], r[i + 1])
print(int(np.max(m)))
# Judge status: Wrong Answer
from collections import defaultdict
n, m = map(int, input().split())
ans = defaultdict(int)
for q in range(m):
    ab = list(map(int, input().split()))
    if ab[0] != ab[1]:
        ans[ab[0]] += 1
        ans[ab[1]] += 1
for _, v in sorted(ans.items()):
    print(v)
# Judge status: Accepted
x=int(input())
a=x//11*2
b=x%11
print(a if b==0 else a+1 if b<7 else a+2)
# Judge status: Wrong Answer
if __name__ == "__main__":
    c1 = list(map(int, input().split()))
    c2 = list(map(int, input().split()))
    c3 = list(map(int, input().split()))

    if (sum(c1)+sum(c2)+sum(c3))%3 == 0:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
n, x = map(int, input().split())
L = list(map(int, input().split()))
val = 0
count = 1

for l in L:
    val += l
    if val <= x:
        count += 1
print(count)
# Judge status: Accepted
import math
N,D = map(int, input().split())
p = 2*D+1
print(math.ceil(N/p))
# Judge status: Wrong Answer
def main():
  input_number = list(map(int, input().split()))
  for i in input_number:
    if i==0:
      print(i)
      break

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

k = int(input())

def is_lunlun(i):
    l = [int(x) for x in list(str(i))]
    a = [abs(l[j] - l[j+1]) <= 1 for j in range(len(l)-1)]
        
    return all(a)

def lunlun():
    j = 1
    while True:
        if is_lunlun(j):
            yield j
        j += 1

print(k)
for i,e in enumerate(lunlun()):
    if i == k:
        print(e)
        break
# Judge status: Accepted
s=str(input())
temp=["SUN","MON","TUE","WED","THU","FRI","SAT"]
for i in range(0,7):
  if temp[i]==s:
    print(7-i)
    break
# Judge status: Accepted
n = int(input())
for i in range(7):
    if 2 ** i <= n:
        ans = 2 ** i
    else:
        break
print(ans)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    x,y=map(int,input().split())
    if x==y or x%y==0:
        print(-1)
        sys.exit()
    else:
        for i in range(2,10*6):
            if x*i % y!=0:
                print(x*i)
                sys.exit()

if __name__=='__main__':
    main()
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
cnt1=0
cnt2=0
cnt4=0
for i in range(n):
  if a[i]%2==1:
    cnt1+=1
  elif format(a[i], 'b')[::-1].find('1')==1:
    cnt2+=1
  else:
    cnt4+=1

if cnt2>=2:
  if cnt4>=(n-cnt2)//2:
    print('Yes')
  else:
    print('No')
else:
  if cnt4>=n//2:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
k,x = map(int, input().split())

a = max(-1000000,x - (k-1))
b = min(1000000,x+(k-1))

L = [str(i) for i in range(a,b+1)]
print(" ".join(L))
# Judge status: Wrong Answer
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB = sorted(AB, reverse = True)

ans = 0
day = M

for i in range(N):
  if AB[i][0] <= day:
    ans += AB[i][1]
    day -= 1
  else:
    continue
  if day == 0:
    break
print(ans)
# Judge status: Wrong Answer
N,M = map(int,input().split())
X = list(map(int,input().split()))

ans = 0

if N >= M:
  pass
else:
  X.sort()
  dist = []
  
  for i in range(1,M):
    dist.append(abs(X[i]-X[i-1]))
  dist.sort()
  ans = sum(dist[:-N+1])

print(ans)
# Judge status: Accepted
n,l=map(int,input().split())
a=[l+i-1 for i in range(1,n+1)]
pura=sorted([i for i in a if i>=0])
mai=sorted([i for i in a if i<0])[::-1]
if pura==[]:
    print(sum(mai[1:]))
elif mai==[]:
    print(sum(pura[1:]))
elif abs(pura[0])>=abs(mai[0]):
    print(sum(pura)+sum(mai[1:]))
else:
    print(sum(pura[1:])+sum(mai))
# Judge status: Accepted
A,B = map(int,input().split())
if A == 1:
  A += 13
if B == 1:
  B += 13
if A > B:
  print("Alice")
elif B > A:
  print("Bob")
else:
  print("Draw")
# Judge status: Wrong Answer
n=int(input())
a=n//100
b=n-a*100
c=n%10
if a==7 or b==7 or c==7:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a,b,n = map(int, input().split())
res = 0
for i in range(1,min(n+1,pow(10,7))):
  res = max(res,(a*i)//b - a*(i//b))
print(res)
# Judge status: Accepted
#import math
#import bisect
#import numpy as np
#import itertools
#import copy
#import collections
import sys

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    s = input()
    ss = list(set(s))
    flag = False

    if len(ss) == 2:
        a = s.count(ss[0])
        b = s.count(ss[1])
        if a == b == 2:
            flag = True

    if flag:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
# a, b = map(int, input().split())
print('Christmas' + ' Eve'*(int(input())-25))
# Judge status: Accepted
S = input()
K = int(input())

ans = ''
for s in S:
    to_a_cost = (26 - (ord(s) - 97)) % 26
    if to_a_cost <= K:
        ans += 'a'
        K -= to_a_cost
    else:
        ans += s


if K:
    K %= 26
    ans = ans[:-1] + chr(97 + (((ord(ans[-1]) - 97) + K) % 26))

print(ans)
# Judge status: Wrong Answer
N,M = map(int,input().split())
a = [1]*(N+1)
Answer = []
for i in range(M):
    a[int(input())-1]  = 0
Answer.append(1*a[0])
Answer.append(1*a[1]+1*a[0])
for j in range(2,N):
    A = ((Answer[j-1]%(10**9+7)) + (Answer[j-2]%(10**9+7)))*a[j]
    Answer.append(A%(10**9+7))
print(Answer[-1])
# Judge status: Accepted
from collections import deque
from sys import stdin
input = stdin.readline


def main():
  S = input()[:-1]
  Q = int(input())

  q = deque([S])
  reverse = False
  for i in range(Q):
    line = input().split()
    if line[0] == '1':
      reverse = not(reverse)
    else:
      if reverse ^ (int(line[1])-1):
        # S = S + line[2]
        q.append(line[2])
      else:
        # S = line[2] + S
        q.appendleft(line[2])

  print(''.join(list(reversed(''.join(q)))) if reverse else ''.join(q))


if(__name__ == '__main__'):
  main()
# Judge status: Accepted
contests = [i for i in range(100,1000) if i % 111 == 0]
N = int(input())
for contest in contests:
  if contest >= N:
    print(contest)
    break
  else:
    continue
# Judge status: Accepted

N = int(input())

ans = 0
count = 1

if int(N) % 2 == 1:
    print(ans)
else:
    while (2* (5 ** count)) <= N:
        ans += N // (2* (5 ** count))
        count += 1
    print(ans)
# Judge status: Wrong Answer
X=int(input())
import sys
for i in range(X,10**5+1):
  T=True
  for j in range(2,i):
    if i%j==0:
      T=False
  if T==True:
    print(i)
    break
  else:
    continue
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
d = a-b
print(c-d)
# Judge status: Wrong Answer
nk = list(map(int, input().split()))
p = list(map(int, input().split()))
n = nk[0]
k = nk[1]
maxnum = 0
for i in range(n-k):
    if p[i+k] >= p[i]:
        maxnum = i+k

ans = (sum(p[maxnum-k+1:maxnum+1])+k)/2
print(ans)
# Judge status: Wrong Answer
N, X, T = map(int, input().split())

ans = N // X
if N % X != 0:
    ans += 1

print(ans)
# Judge status: Accepted
a=list(map(int,input().split()))
a.sort()
if a[0]==5 and a[1]==5 and a[2]==7:print("YES")
else:print("NO")
# Judge status: Accepted
from operator import itemgetter

n, h = map(int, input().split())
ab = sorted([list(map(int, input().split())) for i in range(n)], key=itemgetter(0), reverse=True)

max_a = ab[0][0]
ab_s2 = sorted(ab, key=itemgetter(1), reverse=True)
ans = 0
for a, b in ab_s2:
    if b > max_a:
        h -= b
        ans += 1
        if h <= 0:
            break

if h > 0:
    ans += -(-h // max_a)

print(ans)
# Judge status: Wrong Answer
n = int(input())
s = [int(input()) for _ in range(n)]
s.sort()
ans = sum(s)
i = 0
while(ans %10 == 0 and i < n):
    ans -= s[i]
    i+=1
print(ans)
# Judge status: Accepted
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections


a,b = map(int,input().split())
if (a+b)%3 == 0:
    print("Possible")
elif a%3 == 0:
    print("Possible")
elif b%3 == 0:
    print("Possible")
else:
    print("Impossible")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(0,N,2):
  if A[i]%2==1:
    ans+=1
    
print(ans)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    x, a, b = map(int, input().split())

    if abs(x - a) < abs(x - b):
        ans = "A"
    else:
        ans = "B"

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
D,T,S = map(int,input().split())
if D/S <=T :
 print("YES")
else  :                       
 print("NO")
# Judge status: Accepted
N = int(input())

nums = list(map(int,input().split(' ')))

count = 0
existOdd = True
while existOdd:
    for i in nums:
        if i%2!=0:
            existOdd = False
            break
    
    if existOdd:
        for i in range(N):
            nums[i] /= 2
        
        count+=1
    
print(count)
# Judge status: Accepted
N = int(input())

ans = ""

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

while N != 0:
    a, b = divmod(N, 2)
    ans = str(b) + ans
    N = -a

print(ans)
# Judge status: Wrong Answer
S = "ABC"

if S == "ABC":
    print("ARC")
else:
    print("ABC")
# Judge status: Wrong Answer
A = int(input())
B = int(input())
for i in range(1,3):
    if i != A and i != B:
        print(i)
# Judge status: Accepted
from functools import reduce
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))

print(reduce(gcd, A))
# Judge status: Wrong Answer
x,y = map(int,input().split())
if x!=y:
    print(x)
else:
    print(-1)
# Judge status: Wrong Answer
N = int(input())
s = input().split()
print("\n")
print(len(set(s)))
# 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<max(x)+1<=Y) & (max(x)< min(y))):
  print('No War')
else :
  print('War')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
c = 0
count4 = 0

for i in a:
  if i%4 == 0:
    count4 += 1
  if i%2 == 0:
    c += 1
only2 = c-count4
if only2 == 0 and count4 + 1 == len(a)-c:
  print('Yes')
elif count4 < len(a)-c:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
A=int(input())
B=int(input())
C=int(input())
X=int(input())

cnt=0
for i in range(A+1):
  for j in range(B+1):
    S=500*i+100*j
    if S>X:
      break
    #print(i,j,(X-S)/50)
    if (X-S)%50==0 and (X-S)/50<=C:
      cnt +=1
print(cnt)
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 7)

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

# WA

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

START = S[0]
prev = S[0]
ans = 0
for i in range(1, N):
    s = S[i]

    if prev == s:
        ans += 1
    else:
        if s == START and K > 0:
            ans += 2 if i < N-1 else 1
            K -= 1

        prev = s

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

count = 0
for i in range(1, n+1):
    if i % 2 == 1 and a_list[i-1] % 2 == 1:
        count += 1
print(count)
# Judge status: Wrong Answer


def solve():
    N = int(input())
    As = list(map(int, input().split()))

    Bs = []

    for i in range(N):
        Bs.append(As[i]-i-1)

    Bs.sort()
    b = Bs[N//2]

    ans = 0

    for i in range(N):
        ans += Bs[i]-b

    print(ans)


# Solve
if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
n = int(input())

for i in range(1000):
  if 100*i<=n and 105*i<=n:
    print("1")
    exit()
print("0")
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n-2):
  if p[i] < p[i+1] < p[i+2] or p[i] > p[i+1] > p[i+2]:
    count += 1
print(count)
# Judge status: Wrong Answer
a,v = input().split()
b,w = input().split()
t = input()

a_kyori = int(t) * int(v) + int(a)
b_kyori = int(t) * int(w) + int(b)

if a_kyori >= b_kyori:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
D = int(input())
n = D-25
eve = " Eve"
print("Christmas"+eve*n)
# Judge status: Accepted
n, m = map(int, input().split())

ab =[[] for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    ab[a-1].append(b-1)
    ab[b-1].append(a-1)

for i in ab:
    print(len(i))
# Judge status: Wrong Answer
K = int(input())

t = -1
for i in range(1,10**6):
    for j in range(len(str(i)) - 1):
        if abs(int(str(i)[j]) - int(str(i)[j+1])) > 1:
            break
    else:
        t += 1
        #print(i,t)
    if t+1 == K:
        break
print(i)
# Judge status: Wrong Answer
n , m = map(int, input().split())

lis = []
for _ in range(m):
    lis.append(list(map(int, input().split())))

t = 1
tmp = sorted(lis)[0][0]

for i in sorted(lis):
    if tmp == i[0]:
        a = str(i[0])
        left = a.zfill(6)
        right = str(t).zfill(6)
        t += 1
    else:
        t = 1
        tmp = i[0]
        left = str(i[0]).zfill(6)
        right = str(t).zfill(6)
    
    print(left+right)
# Judge status: Accepted
n,m = map(int,input().split())
s = []
for i in range(n):
  s.append(tuple(map(int,input().split())))
p = []
for i in range(m):
  p.append(tuple(map(int,input().split())))

for a,b in s:
  mnl = float('inf')
  for i in range(m):
    c,d = p[i]
    l = abs(a-c)+abs(b-d)
    if l < mnl:
      mnp = i+1
      mnl = l
  print(mnp)
# Judge status: Wrong Answer
from math import sqrt as r
a, b, c = map(int, input().split())

if (a + b + 2 * r(a * b)) < c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
S=list(input())
cnt=0
tmp=S[0]
for i in range(len(S)):
    if i == 0:continue
    if S[i] == tmp:
        cnt += 1
    tmp = S[i]        
print(cnt)
# Judge status: Accepted
# coding: utf-8
N, M = map(int, input().split())
print(abs(N * M - (N+M)*2 + 4))
# Judge status: Wrong Answer
n,p=map(int,input().split())
a=[i%2 for i in list(map(int,input().split()))]
e=a.count(0)
o=a.count(1)
if n==1 and sum(a)%2!=p:
	print(0)
else:
	print((2**e)*(2**o)//2)
# Judge status: Accepted
n, k = map(int, input().split())
A = [0] + list(map(int, input().split()))

here = 1
log = [1]
loop = []
num_log = [0] * (n + 1)
num_log[1] = 1
for i in range(k):
    here = A[here]
    if num_log[here] == 1:
        pre_loop = log.index(here)
        k = k - pre_loop
        loop = log[pre_loop:]
        here = loop[k % len(loop)]
        break
    else:
        num_log[here] = 1
    log += [here]
print(here)
# Judge status: Accepted
S=input()

if S=="hi" or S=="hihi" or S=="hihihi" or S=="hihihihi" or S=="hihihihihi":
  print("Yes")
else:
  print("No")
# Judge status: Accepted
A,B,K = list(map(int,input().split()))
if K <= A:
  print(A-K," ",B)
else:
  print(0," ",max(A+B-K,0))
# Judge status: Accepted
import math
A, B = map(int,input().split())
print(A * B // math.gcd(A, B))
# Judge status: Accepted
n=input()

if n.isupper():
  print("A")
else:
  print("a")
# Judge status: Accepted
n, k = map(int, input().split())
h = [int(i) for i in input().split()]

def chmin(a, b):
    if a > b:
        return b
    else:
        return a
f_inf = pow(10,9)+99

dp = [f_inf] * (n+1)
dp[0] = 0
for i in range(1, n):
    for j in range(1, k+1):
        if i - j >= 0:
            dp[i] = chmin(dp[i], dp[i-j]+ abs(h[i] - h[i - j]))
print(dp[n-1])
# Judge status: Accepted
n = int(input())
i = 0
while i**2 <= n:
    result = i**2
    i += 1
print(result)
# Judge status: Accepted
#!/usr/bin/env python3
import math 
a, b = input().split()
c = int(a + b)

if math.sqrt(c).is_integer():
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
# sumitb2019_b_bacha.py
N = int(input())
for i in range(N):
    if int(i*1.08) == N:
        print(i)
        exit()
print(":(")
# Judge status: Accepted
import sys

def main():
    K = int(input())

    odd = K // 2
    even = K - odd

    print(odd * even)

main()
# Judge status: Wrong Answer
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
sortx = sorted(X)
bef = sortx[N//2-1]
aft = sortx[N//2]
for i in range(N):
        print(aft if i <= bef else bef)
# Judge status: Accepted
n = int(input())
al = list(map(int, input().split())) 

res = 1
from collections import Counter
count = Counter(al)
cc = count[0]

if cc >=1:
    print(0)
    exit()

for i in range(n):
    res *= al[i]    
    if res > 10**18:
        print(-1)
        exit()

else:        
    print(res)
# Judge status: Accepted
A,B = list(map(int, input().split()))
flag = 0

for j in range(1250):
    if int(j*0.08) == A and int(j*0.10) == B:
        print(j)
        flag = 1
        break

if flag == 0:
    print(-1)
# Judge status: Accepted
S = input()
from collections import Counter
ctr = Counter(S)

mx = max(ctr.values())
mn = min(ctr.values())
if len(ctr) < 3: mn = 0
if abs(mx-mn) < 2:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
n, a, b = list(map(int, input().split()))

#print(n)
#print(a)
#print(b)

t = 0
ans = 0

for ii in range(n) :
  i = ii+1
  t100 = i // 100
  t10  = (i%100) // 10
  t1   = i%10
  sum = t100 + t10 + t1

  #print("i : " + str(i))
  #print("t100 : " + str(t100))
  #print("t10 : " + str(t10))
  #print("t1 : " + str(t1))
  #print("sum : " + str(sum))

  if a <= sum and sum <= b :
    ans = ans + i
    #print("ans : " + str(ans))

print(ans)
# Judge status: Wrong Answer
n,m= map(int, input().split())
ans=[]
if n%2==1:
    for i in range(m):
        ans.append(i+1)
        ans.append(n-1-i)

else:
    for i in range(m):
        ans.append(i+2)
        ans.append(n-i-1)

print(*ans)
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int, input().split()))
num = []
for i in range(N):
    num.append(A[i])
    num.append(A[i] + 1)
    num.append(A[i] - 1)
#print(num)
num_count = collections.Counter(num)
#print(num_count.values())
print(max(num_count.values()))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
ans = {a:i for i,a in enumerate(A,1)}

for i in range(N):
    print(ans[i+1])
# Judge status: Wrong Answer
def main():
    N = int(input())
    H = list(map(int, input().split(" ")))
    flag = True
    for i in range(N - 1):
        if H[i] - H[i + 1] <= 0:
            H[i + 1] -= 1
    for j in range(N - 1):
        if H[j + 1] - H[j] < 0:
            flag = False
            break
    if flag:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
A = [int(input()) for i in range(N)]

from collections import Counter
c = Counter(A)
keys, values = zip(*c.most_common())

n = len(values)
ans = 0

for i in range(n):
    if values[i]%2 == 1:
        ans += 1
        
print(ans)
# Judge status: Accepted
k=input()
a=int(k[0])
b=int(k[1])
c=int(k[2])
d=int(k[3])
op1=["+","-"]
op2=["+","-"]
op3=["+","-"]
flag=0
for i in range(2):
  for j in range(2):
    for l in range(2):
      siki=k[0]+op1[i]+k[1]+op2[j]+k[2]+op3[l]+k[3]
      if (eval(siki)==7):
        print(siki+"=7")
        flag=1
      if (flag==1):
        break
    if (flag==1):
      break
  if (flag==1):
    break
# Judge status: Accepted
n = int(input())
c = input()

r_cnt = 0
for i in range(n):
    if c[i] == 'R':
        r_cnt += 1


r_cnt_2 = 0
for i in range(r_cnt):
    if c[i] == 'R':
        r_cnt_2 += 1

if r_cnt == n:
    print(0)
else:
    print(r_cnt - r_cnt_2)
# Judge status: Accepted
n=int(input())
ans=n*(n+1)//2
print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#N = int(input())
a, b = map(str, input().split())

d = int(a+b)

if d == (math.floor(d**0.5) ** 2) :
  print ("Yes")
else :
  print ("No")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
x = 0
total = 0


for i in range(n-1):
    if a[i] >= a[i+1]:
        x = a[i] - a[i+1]
        total += x
        a[i+1] = a[i]
        i = i+1
    else:
        total += 0

print(total)
# Judge status: Accepted
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

diff = N - M
for i in range(diff+1):
    for j in range(diff+1):
        flag = True
        for k in range(M):
            if not (B[k] in A[j+k][i:i+M]):
                flag = False
        if flag:
            print('Yes')
            exit(0)

print('No')
# Judge status: Wrong Answer
N, M = list(map(int,input().split()))
L = []
for i in range(N):
  L.append(list(map(int,input().split())))
L = sorted(L)
a = 0
c = 0
for i in range(N):
  a = a + L[i][1]
  if a > M:
    c = i
    break
p = 0
for j in range(c):
  p += L[j][0]*L[j][1]

p += L[c][0]*(M - a + L[c][1])

print(p)
# Judge status: Wrong Answer
N,M = map(int,input().split())

if (N==M):
    print("Yes")
elif(N!=M):
    print("NO")
# Judge status: Accepted
def resolve():
    n,x=map(int, input().split())
    l=list(map(int, input().split()))
    num=1
    zahyou=0
    for i in range(n):
        zahyou+=l[i]
        if zahyou<=x:
            num+=1
    print(num)
resolve()
# Judge status: Accepted
a,b,k = map(int,input().split())

if a-k>0:
  a -= k
  print(a,b)
  exit()
else:
  k -= a
  a = 0
if b-k>0:
  b -=k
  print(a,b)
  exit()
else:
  print(a,0)
# Judge status: Accepted
x, y = map(int, input().split())
a=[1, 3, 5, 7, 8, 10, 12]
b=[4, 6, 9, 12]
c=[2]
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
    print("Yes")
else: 
    print("No")
# Judge status: Accepted
N, A, B = map(int,input().split())

count = 0

for i in range(1, N + 1):
    dict_sum = sum(map(int, str(i)))
    if A <= dict_sum <= B:
        count = count + i

print(count)
# Judge status: Accepted
n,m=list(map(int,input().split()))
mm=int((m+1)/2+0.01)
for i in range(mm):
  print(1+i,2*mm-i)
for i in range(m-mm):
  print(2*mm+i+1,2*m-i+1)
# Judge status: Wrong Answer
S = input('曜日を入力してね！ ')

if S == 'SUN':
    print('7')

if S == 'MON':
    print('6')

if S == 'TUE':
    print('5')

if S == 'WED':
    print('4')

if S == 'THU':
    print('3')

if S == 'FRI':
    print('2')

if S == 'SAT':
    print('1')
# Judge status: Accepted
N, A, B = list(map(int, input().split()))

SUM=0
a = N % (A + B)
if a > A:
    SUM = A
else:
    SUM = a 

SUM = SUM + (N // (A + B)) * A

print(SUM)
# Judge status: Accepted
import sys


def input():
    return sys.stdin.readline().strip()


n, k = map(int, input().split())
H = list(map(int, input().split()))

INF = 10 ** 9
dp = [INF] * n
dp[0] = 0
for i in range(n - 1):
    for j in range(1, k + 1):
        if j >= n - i:
            break
        dp[i + j] = min(dp[i + j], dp[i] + abs(H[i + j] - H[i]))
print(dp[-1])