Harryxun/stf_run huggingface dataset:
# coding: utf-8
# Your code here!

def main():
    number_of_human = int(input())
    position_list = list(map(int,input().split()))
    
    start_position = min(position_list)
    end_position = max(position_list)
    
    answear_list = []
    
    while True:
        answear = sum([(item - start_position)**2 for item in position_list])
        if start_position == end_position:
            break
        start_position += 1
        answear_list.append(answear)
    
    print(min(answear_list))
    
if __name__ == "__main__":
    main()
    


### FIXED CODE ###

# coding: utf-8
# Your code here!

def main():
    number_of_human = int(input())
    position_list = list(map(int,input().split()))
    
    start_position = min(position_list)
    end_position = max(position_list)
    max_answear = sum([(item - start_position)**2 for item in position_list])
    while True:
        answear = sum([(item - start_position)**2 for item in position_list])
        if start_position == end_position:
            break
        start_position += 1
        if answear < max_answear:
            max_answear = answear
    
    print(max_answear)
if __name__ == "__main__":
    main()
while 1:
H , W = map(int, raw_input().split())

if H == 0 and W == 0:
  break
for _  in range(H):
  print ("#" * W + "\n")
    
    

### FIXED CODE ###

while 1:
  h, w = map(int, raw_input().split())
  if h == 0 and w == 0:
    break
  for i in range(h):
    print "#" * w
  print""
import math
import sys

X, Y = map(int, input().split())

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

if (X + Y) % 3 != 0:
    print(0)
    sys.exit()

x = X - ((X + Y) // 3)
y = Y - ((X + Y) // 3)

mod = 10 ** 9 + 7

numerater = math.factorial(x + y) % mod
denominator_x = math.factorial(x) % mod
denominator_y = math.factorial(x) % mod
denominator = (denominator_x * denominator_y) % mod

res = (numerater * mod_inv(denominator, mod)) % mod

print(res)

### FIXED CODE ###

import math
import sys

X, Y = map(int, input().split())

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

if (X + Y) % 3 != 0:
    print(0)
    sys.exit()

if X / 2 > Y or Y > X * 2:
    print(0)
    sys.exit()

x = X - ((X + Y) // 3)
y = Y - ((X + Y) // 3)

mod = 10 ** 9 + 7

numerater = 1
for i in range(1, x+y+1):
    numerater =  (numerater * i) % mod

denominator_x = 1
for i in range(1, x+1):
    denominator_x = (mod_inv(i, mod) * denominator_x) % mod

denominator_y = 1
for i in range(1, y+1):
    denominator_y = (mod_inv(i, mod) * denominator_y) % mod

res = (numerater * denominator_x * denominator_y) % mod

print(res)
s=inout
if s == "Sunny"
print("Cloudy")
if s == "Cloudy"
print("Rainy")
if s == "Rainy"
print("Sunny")

### FIXED CODE ###

s = input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
elif s == "Rainy":
    print("Sunny")
N,M = map(int,input().split())

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

check = [False] * N

def dfs(now):
    global cnt
    global ans
    if cnt == N:
        ans += 1
    else:
        for i in line[now]:
            if check[i] == False:
                check[i] = True
                cnt += 1
                dfs(i)
                check[i] = False
                cnt -= 1

check[0] = True
cnt = 1
ans = 0
dfs(0)
print(ans)

### FIXED CODE ###

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

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

check = [False] * N

def dfs(now):
    global cnt
    global ans
    if cnt == N:
        ans += 1
    else:
        for i in line[now]:
            if check[i] == False:
                check[i] = True
                cnt += 1
                dfs(i)
                check[i] = False
                cnt -= 1

check[0] = True
cnt = 1
ans = 0
dfs(0)
print(ans)
a,b = map(int, input().split())

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

def prime(n):
    factor = {}
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            if not num in factor.keys():
                factor[num] = 1
            else:
                factor[num] += 1
    if n != 1:
        if not n in factor.keys():
            factor[n] = 1
        else:
            factor[n] += 1
    return factor

g = gcd(a,b)
fac = prime(g)
print(len(fac)+1)


### FIXED CODE ###

import math

a,b = map(int, input().split())
 
def gcd(a, b):
  while b:
      a, b = b, a % b
  return a
 
def prime(n):
    factor = {}
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            if not num in factor.keys():
                factor[num] = 1
            else:
                factor[num] += 1
    if n != 1:
        if not n in factor.keys():
            factor[n] = 1
        else:
            factor[n] += 1
    return factor

g = gcd(a,b)
fac = prime(g)
print(len(fac)+1)
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=0
cnt=1
for j in range(0,N+1):
    D=D+L[j]
    if D<=X:
        cnt+=1
    else:
        break
print(cnt)

### FIXED CODE ###

N,X=map(int,input().split())
L=list(map(int,input().split()))
D=0
cnt=1
for i in L:
    D=D+i
    if D>X:
        break
    cnt+=1
print(cnt)
N = int(input()) ans='' whileN>0:
N -= 1
ans += chr(ord('a') + N % 26) N //= 26
print(ans[::-1])

### FIXED CODE ###

N = int(input()) 
ans='' 
while N>0:
    N -= 1
    ans += chr(ord('a') + N % 26) 
    N //= 26
print(ans[::-1])
from collections import Counter
N = int(input())
a = list(map(int, input().split()))
i_list = []
#return tuple list: Counter().most_common()                                                                          for i in a:
    i_list.append(i-1)
    i_list.append(i)
    i_list.append(i+1)
print(i_list)
print(Counter(i_list).most_common()[0][1])

### FIXED CODE ###

from collections import Counter
N = int(input())
a = list(map(int, input().split()))
i_list = []
for i in a:
    i_list.append(i-1)
    i_list.append(i)
    i_list.append(i+1)
print(Counter(i_list).most_common()[0][1])
h, w = input().split()
h = int(h)
w = int(w)
field = []
for _ in range(h):
    field.append(input())
    
ans = True
for i in range(h):
    for j in range(w):
        if field[i][j] == '#':
            temp = 1
            dd = [(1, 0), (-1, 0), (0, 1), (0, -1)]
            for ddd in dd:
                dx, dy = ddd
                nx, ny = x + dx, y + dy
                if nx >= 0 and nx < h and ny >= 0 and ny < w and field[nx][ny] == '#':
                    temp += 1
            if temp == 1:
                ans = False
                break

if ans:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

h, w = input().split()
h = int(h)
w = int(w)
field = []
for _ in range(h):
    field.append(input())
    
ans = True
for i in range(h):
    for j in range(w):
        if field[i][j] == '#':
            temp = 1
            dd = [(1, 0), (-1, 0), (0, 1), (0, -1)]
            for ddd in dd:
                dx, dy = ddd
                nx, ny = i + dx, j + dy
                if nx >= 0 and nx < h and ny >= 0 and ny < w and field[nx][ny] == '#':
                    temp += 1
            if temp == 1:
                ans = False
                break

if ans:
    print("Yes")
else:
    print("No")
n,k = list(map(int, input().split(" ")))
a_lst = list(map(int,input().split(" ")))


plus_lst = list(filter(lambda num: num >= 0 , a_lst))
minus_lst = list(filter(lambda num: num < 0 , a_lst))
plus_lst.sort(reverse=True)
minus_lst.sort(reverse=True)


# +,-どちらもk以上ある
	# max(abs+,abs-)で大きい方をk-1回目までとる, k-1回目で+だったら+, -だったら-
# +: kない, -: kある
	# +の数が残り1になるまでabsでやる,最後に+を使って調整する
# +: kある, -: kない
	# -の数が1になるまでabsでやる, 最後に-を使って調整
# +: kない, -: kない
	# どちらかが残り1になるまでやる,最後に調整
# -のみ
	# absでできるだけ小さいものを使う

# 0を抜いたらk個なかった場合、絶対どっかで0を掛けるので0
# 全部-の場合
if(len(plus_lst) == 0):
	total = 1
	for i in range(k):
		total *=minus_lst[i]
	print(total % (10**9 + 7))
elif(len(minus_lst) == 0):
	total = 1
	for i in range(k):
		total *= plus_lst[i]
	print(total % (10**9 + 7))
else:
	total = 1
	for i in range(k):
		if(i == k - 1):
			if(total > 0):
				total *= plus_lst.pop(0)
			else:
				total *= minus_lst.pop(-1)
		else:
			# plus残り1の場合
			if(len(plus_lst) == 1):
				total *= minus_lst.pop(-1)
			# minus残り1の場合
			elif(len(minus_lst) == 1):
				total += plus_lst.pop(0)					
			# +-どっちも十分あった場合
			else:
				plus_max = plus_lst[0]
				minus_max = minus_lst[0]
				if(abs(plus_max) > abs(minus_max)):
					plus_lst.pop(0)
					total *= plus_max
				else:
					minus_lst.pop(-1)
					total *= minus_max
	print(total % (10**9 + 7))


### FIXED CODE ###

n = int(input())

if(n % 1000 == 0):
	print(0)
else:
	print(1000 - n % 1000)
n=int(input())
dat = list(map(int, input().split()))
dan = []
for e in dat:
    e = str(bin(e))
    e=e[2:]
    e=list(e)
    e.reverse()
    
     
                

         
           




### FIXED CODE ###

import sys

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

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

main()
import math
import sys

def func(a,b,c,d,e,f):
    try:
        aa=(c-e)**2+(d-f)**2
        bb=(a-e)**2+(b-f)**2
        cc=(a-c)**2+(b-d)**2
        o,p,q=bb+cc-aa,cc+aa-bb,aa+bb-cc
        m=aa*o+bb*p+cc*q

        px=(aa*o*a+bb*p*c+cc*q*e)/m
        py=(aa*o*b+bb*p*d+cc*q*f)/m

        r = math.hypot(px-a, py-b)
        return px,py,r

    except ZeroDivisionError:
        return 0,0,10**6

n=int(input())

x,y=[],[]
for i in range(n):
    a,b=map(int,input().split())
    x.append(a)
    y.append(b)


if n==2:
    print(math.hypot(x[0]-x[1],y[0]-y[1])/2)
    sys.exit()
elif n==3:
    px,py,r=func(x[0],y[0],x[1],y[1],x[2],y[2])
    print(r)
    sys.exit()
    

minr=10**6
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            px,py,r=func(x[i],y[i],x[j],y[j],x[k],y[k])

            sgn=1
            for p in range(n):
                if math.hypot(x[p]-px,y[p]-py)>r:
                    sgn=0
            if sgn==1: minr=min(minr,r)

print(minr)

### FIXED CODE ###

n=input()
ans=chr(ord(n)+1)

print(ans)
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# N**2の解法
N, M, Q = lr()
graph = np.array([[0] * (501) for _ in range(501)])  # 1-indexed
for i in range(M):
    l, r = lr()
    graph[l][r] += 1

for i in range(M):
    graph[i] = graph[i].cumsum()

graph = np.cumsum(graph, axis=0)
for _ in range(Q):
    p, q = lr()
    answer = graph[q][q] - graph[q][p-1] - graph[p-1][q] + graph[p-1][p-1]
    print(answer)

# 30

### FIXED CODE ###

import numpy as np

N, M, Q = map(int, input().split())
data = [[0] * (N+1) for _ in range(N+1)]

for i in range(M):
    l, r = map(int, input().split())
    data[l][r] += 1

data = np.array(data)
np.cumsum(data, axis=0, out=data)
np.cumsum(data, axis=1, out=data)
data = data.tolist()
#print(data)
for i in range(Q):
    p, q = map(int, input().split())
    p -= 1
    x = data[q][q]
    x -= data[p][q] + data[q][p]
    x += data[p][p]
    print(x)
import sys
sys.setrecursionlimit(10000)


def initRMQ(n):
    n_ = 1

    while n_ < n:
        n_ *= 2

    D = []
    for _ in range(2*n_ - 1):
        D.append(0)

    return n_, D


def update(k, a):
    k += n_ - 1
    D[k] += a
    while k > 0:
        k = int((k - 1) / 2)
        D[k] = D[k*2 + 1] + D[k*2 + 2]


def findSum(a, b):
    return query(a, b + 1, 0, 0, n_)


def query(a, b, k, l, r):
    #print('q', a, b, k, l, r)
    if r <= a or b <= l:
        return 0

    if a <= l and r <= b:
        return D[k]

    vl = query(a, b, k*2 + 1, l, int((l + r)/2))
    vr = query(a, b, k*2 + 2, int((l + r)/2), r)

    return vl + vr


if __name__ == '__main__':
    n, q = map(int, input().split())

    n_, D = initRMQ(n)

    for _ in range(q):
        #print(D)
        c, x, y = map(int, input().split())

        if c == 0:
            update(x, y)

        else :
            print(findSum(x, y))



### FIXED CODE ###

import sys
sys.setrecursionlimit(10000)


def initRMQ(n):
    n_ = 1

    while n_ < n:
        n_ *= 2

    D = []
    for _ in range(2*n_ - 1):
        D.append(0)

    return n_, D


def update(k, a):
    k += n_ - 1
    D[k] += a
    while k > 0:
        k = int((k - 1) / 2)
        D[k] = D[k*2 + 1] + D[k*2 + 2]


def findSum(a, b):
    return query(a, b + 1, 0, 0, n_)


def query(a, b, k, l, r):
    #print('q', a, b, k, l, r)
    if r <= a or b <= l:
        return 0

    if a <= l and r <= b:
        return D[k]

    vl = query(a, b, k*2 + 1, l, int((l + r)/2))
    vr = query(a, b, k*2 + 2, int((l + r)/2), r)

    return vl + vr


if __name__ == '__main__':
    n, q = map(int, input().split())

    n_, D = initRMQ(n)

    for _ in range(q):
        #print(D)
        c, x, y = map(int, input().split())

        if c == 0:
            update(x - 1, y)

        else :
            print(findSum(x - 1, y - 1))
N=int(input())

for i in range(1,N+1):
  tmp=0
  t=i**(1/2)
  for j in range(1,int(t)+1):
    if i%j==0:
      tmp+=1
      
  if t-int(t)<=1e-3:
    if tmp*2-1==8:
      ans+=1
      
  else:
    if tmp*2==8:
      ans+=1
      
print(ans)    

### FIXED CODE ###

N=int(input())

ans=0
for i in range(1,N+1,2):
  tmp=0
  t=i**(1/2)
  for j in range(1,int(t)+1):
    if i%j==0:
      tmp+=1
      
  tmp=tmp*2
  if t-int(t)<=1e-3:
    tmp-=1

  if tmp==8:
    ans+=1
      
print(ans)
N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100*(10−K)

print(ans)


### FIXED CODE ###

N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100*(10 - N)

print(ans)
S = int(input())
total = 0
S1 = str(S)
for i in range(0,S,2019):
  j = str(i)
  if j in S1:
    total+=1
print(total)

### FIXED CODE ###

S,W = [int(x) for x in input().split()]
if S>W:
  print("safe")
else:
  print("unsafe")
a,s=map(int,input().split())
if a%2==b%2:
  print((a+s)//2)
else:
  print("IMPOSSIBLE")

### FIXED CODE ###

a,s=map(int,input().split())
if a%2==s%2:
  print((a+s)//2)
else:
  print("IMPOSSIBLE")
s = input()
ac = True
c = True
if s[0] != "A":
  ac = False
if not ord("a") <= ord(s[1]) <= ord("z"):
  ac = False
if not ord("a") <= ord(s[-1]) <= ord("z"):
  ac = False
for i in range(2, len(s)-1):
  if s[i] == "C":
    if c:
      c = False
    else:
      ac = False
  else:
    if not ord("a") <= ord(s[i]) <= ord("z"):
    ac = False
if ac:
  print("AC")
else:
  print("WA")

### FIXED CODE ###

s = input()
ac = True
c = True
if s[0] != "A":
  ac = False
if not ord("a") <= ord(s[1]) <= ord("z"):
  ac = False
if not ord("a") <= ord(s[-1]) <= ord("z"):
  ac = False
for i in range(2, len(s)-1):
  if s[i] == "C":
    if c:
      c = False
    else:
      ac = False
  else:
    if not ord("a") <= ord(s[i]) <= ord("z"):
      ac = False
if c:
  ac = False
if ac:
  print("AC")
else:
  print("WA")
if S = "ABC"{
  print("ARC")
}else{
  print("ABC")
             

### FIXED CODE ###

S = input()

if S == "ABC":
  print("ARC")
else:
  print("ABC")
def rec (i,a,b,c):
    if i==N:
        if a==0 and b==0 and c==0:
            return INF
        else:
            return abs(a-A)+abs(b-B)+abs(c-C)
    res = rec(i+1,a,b,c)
    
    res = min(res,rec(i+1,a+L[i],b,c)+(10 if a>0 else 0))
    res = min(res,rec(i+1,a,b+L[i],c)+(10 if b>0 else 0))
    res = min(res,rec(i+1,a,b,c+L[i])+(10 if c>0 else 0))
    
    return res
N,A,B,C = list(map(int,input().split()))
L = [int(input()) for _ in range(N)]
print(rec(0,0,0,0))

### FIXED CODE ###

def rec (i,a,b,c):
    if i==N:
        if a==0 or b==0 or c==0:
            return INF
        else:
            return abs(a-A)+abs(b-B)+abs(c-C)
    res = rec(i+1,a,b,c)
    
    res = min(res,rec(i+1,a+L[i],b,c)+(10 if a>0 else 0))
    res = min(res,rec(i+1,a,b+L[i],c)+(10 if b>0 else 0))
    res = min(res,rec(i+1,a,b,c+L[i])+(10 if c>0 else 0))
    
    return res
N,A,B,C = list(map(int,input().split()))
INF=10**8
L = [int(input()) for _ in range(N)]
print(rec(0,0,0,0))
s=input();print['NA','MMYY','YYMM','AMBIGUOUS'][(99<s<1300)-(0<s%100<13)*2]

### FIXED CODE ###

s=input();a,b=int(s[:2]),int(s[2:]);print(['NA','MMYY','YYMM','AMBIGUOUS'][(0<a<13)-(0<b<13)*2])
n,a=map(int,input().split())

apples=[a+i for i in ragen(n)]
eat=min(apples,key=lambda x:abs(x))
res=sum(apples)-eat

print(res)

### FIXED CODE ###

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

l=[a+i-1 for i in range(1,n+1)]

import numpy as np
b=min(np.abs(l))

if b==0:
  l.remove(0)
elif b in l:
  l.remove(b)
elif -b in l:
  l.remove(-b)
  
print(sum(l))
n = int(input())
a = list(map(int,input().split()))
l = [0]*n
l[0] = a[0]

for i in range(1,n):
    l[i] = l[i-1] + a[i]

ans = 10**9+1
for i in range(len(l)-1):
    x = l[i]
    y = sum - l[i]
    tmp = abs(x-y)
    ans = min(ans,tmp)

print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
l = [0]*n
l[0] = a[0]

for i in range(1,n):
    l[i] = l[i-1] + a[i]
sum = sum(a)
ans = 10**10+1
for i in range(len(l)-1):
    x = l[i]
    y = sum - l[i]
    tmp = abs(x-y)
    ans = min(ans,tmp)

print(ans)
"""
最短距離が2であるようなノードの組み合わせは、最高で(N-1)C2個存在する。
そこで、この(N-1)C2個の組み合わせがある状態をデフォルトとして、K個になるまで辺を増やしていく。
"""
import math
def choose(n,k):
    return math.factorial(n)//(math.factorial(n-k)*math.factorial(k))
N,K = map(int,input().split())
if K > choose(N-1,2):
    print(-1)
else:
    edges = []
    for i in range(2,N+1):
        edges.append((1,i))
    rest = choose(N-1,2) - K
    for i in range(2,N+1):
        for j in range(i+1,N+1):
            if rest == 0:
                break
            else:
                edges.append((i,j))
                rest -= 1
        else:
            continue
        break
    print(len(edges))
    for u,v in edges:
        print(" ".join([str(u),str(v)]))


### FIXED CODE ###

"""
Nの制約数の少なさてきに、全探索するのがよさそう。
とはいえ、ありうるすべてのグラフパターンを全探索したら、2**(N^2)かかる

N本目以降は、辺の数を増やせば増やすほど、有効なペアの数が減っていく。
逆にいうと、ペアの数を減らしたい場合は、N本目以降を追加する
"""
N,K = map(int,input().split())
if K > N*(N-1)//2-(N-1):
    print(-1)
    exit()
edges = []
base = 1
for i in range(base+1,N+1):
    edges.append(" ".join([str(base),str(i)]))

diff = (N-1)*(N-2)//2 - K
base = 2
while diff:
    for i in range(base+1,N+1):
        if diff == 0:
            break
        else:
            edges.append(" ".join([str(base),str(i)]))
            diff -= 1
    base += 1
print(len(edges))
for ans in edges:
    print(ans)
import itertools as it
import collections
 
n, x, y = list(map(int, input().split(' ')))
 
dist_list = []
dist_a = dist_list.append
for i, j in it.combinations(list(range(n)), 2):
    warp_dist = abs(i - (x - 1)) + 1 + abs(j - (y - 1))
    if abs(j - i) < warp_dist:
        dist_a(abs(j - i))
    else:
        dist_a(warp_dist)
 
dist_c = collections.Counter(dist_list)
 
for i in range(1, n):
    print(dist_c[i])

### FIXED CODE ###

s = input()

s_list = [i for i in s]

if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
N, M = list(map(int, input().split()))

p = [0] * M
S = [''] * M


for i in range(M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])

dp = [[0] * 2 for i in range(N)]  # x問目の、score, 正答までのwrong_ans                                               #dp = [[0] * 2 for i in range(100005)]  # x問目の、score, penalty

for i in range(M):
    num = p[i] - 1
    # 未得点のときだけ影響
    if(dp[num][0] == 0):
         if(S[i] == 'WA'):
             dp[num][1] += 1
             continue

         elif(S[i] == 'AC'):
             dp[num][0] += 1
             continue
         else:
             print("S is ??")

score = 0
penalty = 0
for i in range(len(dp)):
    score += dp[i][0]
    penalty += dp[i][1]

print(score, penalty)
~

### FIXED CODE ###

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

p = [0] * M
S = [''] * M


for i in range(M):
    p[i], S[i] = input().split()
    p[i] = int(p[i])

WAnum = 0
ACnum = 0

WA = [0] * N
AC = [0] * N

for i in range(M):
    num = p[i] - 1
    # 未得点のときだけ影響
    if(AC[num] >= 1):
        continue

    if(S[i] == 'WA'):
        WA[num] += 1

    elif(S[i] == 'AC'):
        AC[num] = 1
        ACnum += 1
        WAnum += WA[num]

print(ACnum, WAnum)
S = input()
T = input()
leng = len(S)
S = sorted(S)
T = sorted(T)
ans = True
for i in range(leng):
    if(S[i] != T[i]):
        ans = False
if(ans):
    print("Yes")
else:
    print"No

### FIXED CODE ###

S = input()
T = input()
leng = len(S)
ans = False

for i in range(leng):
    if(S == T):
        ans = True
    S = S[-1] + S[0:-1]
if(ans):
    print("Yes")
else:
    print("No")
# coding: utf-8
# Your code here!
import copy
S=list(input())
N=len(S)
point=0
hand=copy.deepcopy(S)
panum=sum([j=="p" for j in hand])
pamax=N//2#ポイントの上限
for i in range(N):
    if S[i]=="g":
        pa=sum([hand[j]=="p" for j in range(i+1)])#今まで出したパーの数
        if pa<(i+1)//2 and point<pamax-panum:
            hand[i]="p"
            point+=1
    if point=>pamax-panum:
        break
print(point)
        

### FIXED CODE ###

# coding: utf-8
# Your code here!
import copy
S=list(input())
N=len(S)
point=0
hand=copy.deepcopy(S)
panum=sum([j=="p" for j in hand])
pamax=N//2#ポイントの上限
pa=0
for i in range(N):
    if S[i]=="g" and pa<(i+1)//2 and point<pamax-panum:
        hand[i]="p"
        point+=1
    if point>=pamax-panum:
        break
    if hand[i]=="p":
        pa+=1
print(point)
n = int(input())
dat = []
for i in range(n):
    dat.append(int(input()))
res = []
res.append(0 - dat[0])

import bisect

for i in range(1, n):
    print(res)
    a = bisect.bisect_right(res, 0 - dat[i])
    print("a={0}".format(a))

    if a == len(res):
        res.append( (0 - dat[i]) )
    else:
        res[a] = (0 - dat[i])

print(len(res))

### FIXED CODE ###

def bisect_right(a, x, lo=0, hi=None):
    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo + hi) // 2
        if x > a[mid]:
            hi = mid
        else:
            lo = mid + 1
    return lo

import collections
n = int(input())
dat = []
for i in range(n):
    dat.append(int(input()))
res = collections.deque([])

res.append(dat[0])
import bisect

for i in range(1, n):
    a = bisect_right(res, dat[i])
    #print("2 : {0}".format(a))

    if a == len(res):
        res.append(dat[i])
    else:
        res[a] = dat[i]
print(len(res))
#print(res)
import math
a=input()
b=input()
c=input()
if a>b:
 print(math.ceil(int(c)/int(a)))
elif a<b:
 print(math.ceil(int(c)/int(b)))
print(int(c)/int())

### FIXED CODE ###

import math
a=input()
b=input()
c=input()
if int(a)>int(b):
 print(math.ceil(int(c)/int(a)))
elif int(a)<int(b):
 print(math.ceil(int(c)/int(b)))
elif int(a)==int(b):
 print(math.ceil(int(c)/int(b)))